From a70c590c3eeee0a988081bdb011018265f385fc2 Mon Sep 17 00:00:00 2001 From: SESA596659 Date: Tue, 16 Mar 2021 10:43:35 +0100 Subject: [PATCH 1/2] Added possiblity to write Junit/tags reports to dbfs paths --- .idea/.gitignore | 3 +++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/nutter.iml | 15 +++++++++++++++ .idea/vcs.xml | 6 ++++++ common/resultreports.py | 12 ++++++++++++ common/testexecresults.py | 8 ++++++++ 8 files changed, 62 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/nutter.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..a2e120d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9fad854 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/nutter.iml b/.idea/nutter.iml new file mode 100644 index 0000000..4f2c9af --- /dev/null +++ b/.idea/nutter.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/common/resultreports.py b/common/resultreports.py index a6bd5fa..3f590ef 100644 --- a/common/resultreports.py +++ b/common/resultreports.py @@ -32,6 +32,10 @@ def has_data(self): def write(self): pass + @abstractmethod + def write_to_dbfs(self, dbfs_path): + pass + def _validate_add_results(self, notebook_path, test_result): if not isinstance(test_result, TestResults): raise ValueError('Expected an instance of TestResults') @@ -85,6 +89,10 @@ def write(self): return report_name + def write_to_dbfs(self, dbfs_path): + self.to_file(dbfs_path) + return dbfs_path + def to_file(self, path): file = open(path, 'w') try: @@ -137,6 +145,10 @@ def write(self): return report_name + def write_to_dbfs(self, dbfs_path): + self.to_file(dbfs_path) + return dbfs_path + def to_file(self, path): file = open(path, 'w') try: diff --git a/common/testexecresults.py b/common/testexecresults.py index 485847e..59d526b 100644 --- a/common/testexecresults.py +++ b/common/testexecresults.py @@ -4,6 +4,7 @@ """ from .apiclientresults import ExecuteNotebookResult, NotebookOutputResult +from .resultreports import JunitXMLReportWriter from .resultsview import RunCommandResultsView from .testresult import TestResults @@ -31,3 +32,10 @@ def get_ExecuteNotebookResult(self, notebook_path, test_results): 'N/A', None, test_results) return ExecuteNotebookResult('N/A', 'N/A', notebook_result, 'N/A') + + def write_junit_xml_report_to_dbfs(self, notebook_path, dbfs_report_path): + junit_xml_report_writer = JunitXMLReportWriter() + junit_xml_report_writer.add_result(notebook_path, self.test_results) + junit_xml_report_writer.write_to_dbfs(dbfs_report_path) + return dbfs_report_path + From 6ec45969b43fc9feda09290fd78b1cfaaf04e9cb Mon Sep 17 00:00:00 2001 From: SESA596659 Date: Tue, 16 Mar 2021 10:45:05 +0100 Subject: [PATCH 2/2] Added possiblity to write Junit/tags reports to dbfs paths --- common/testexecresults.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/testexecresults.py b/common/testexecresults.py index 59d526b..3505cbe 100644 --- a/common/testexecresults.py +++ b/common/testexecresults.py @@ -4,7 +4,7 @@ """ from .apiclientresults import ExecuteNotebookResult, NotebookOutputResult -from .resultreports import JunitXMLReportWriter +from .resultreports import JunitXMLReportWriter, TagsReportWriter from .resultsview import RunCommandResultsView from .testresult import TestResults @@ -37,5 +37,12 @@ def write_junit_xml_report_to_dbfs(self, notebook_path, dbfs_report_path): junit_xml_report_writer = JunitXMLReportWriter() junit_xml_report_writer.add_result(notebook_path, self.test_results) junit_xml_report_writer.write_to_dbfs(dbfs_report_path) + return dbfs_report_path + def write_tags_report_to_dbfs(self, notebook_path, dbfs_report_path): + tags_report_writer = TagsReportWriter() + tags_report_writer.add_result(notebook_path, self.test_results) + tags_report_writer.write_to_dbfs(dbfs_report_path) + + return dbfs_report_path \ No newline at end of file