orionis 0.591.0__py3-none-any.whl → 0.592.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/metadata/framework.py +1 -1
- orionis/test/contracts/unit_test.py +0 -81
- orionis/test/core/unit_test.py +732 -602
- orionis/test/output/printer.py +173 -118
- orionis/test/records/logs.py +223 -83
- orionis/test/view/render.py +45 -17
- {orionis-0.591.0.dist-info → orionis-0.592.0.dist-info}/METADATA +1 -1
- {orionis-0.591.0.dist-info → orionis-0.592.0.dist-info}/RECORD +11 -11
- {orionis-0.591.0.dist-info → orionis-0.592.0.dist-info}/WHEEL +0 -0
- {orionis-0.591.0.dist-info → orionis-0.592.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.591.0.dist-info → orionis-0.592.0.dist-info}/top_level.txt +0 -0
orionis/test/view/render.py
CHANGED
@@ -10,32 +10,52 @@ class TestingResultRender(ITestingResultRender):
|
|
10
10
|
def __init__(
|
11
11
|
self,
|
12
12
|
result,
|
13
|
-
storage_path: str,
|
13
|
+
storage_path: str | Path,
|
14
|
+
filename: str = 'orionis-test-results.html',
|
14
15
|
persist: bool = False
|
15
16
|
) -> None:
|
16
17
|
"""
|
17
|
-
Initializes
|
18
|
+
Initializes a TestingResultRender instance for rendering test results into an HTML report.
|
18
19
|
|
19
20
|
Parameters
|
20
21
|
----------
|
21
|
-
result :
|
22
|
-
The test result data to be rendered in the report.
|
23
|
-
storage_path : str
|
22
|
+
result : dict or list
|
23
|
+
The test result data to be rendered in the report. Must be a dictionary or a list.
|
24
|
+
storage_path : str or Path
|
24
25
|
Directory path where the HTML report will be saved. The directory is created if it does not exist.
|
26
|
+
filename : str, optional
|
27
|
+
The name of the HTML report file (default is 'orionis-test-results.html').
|
25
28
|
persist : bool, optional
|
26
29
|
If True, enables persistent storage for test reports (default is False).
|
27
30
|
|
28
31
|
Returns
|
29
32
|
-------
|
30
33
|
None
|
34
|
+
This method does not return any value.
|
31
35
|
"""
|
32
|
-
|
36
|
+
|
37
|
+
# Validate filename input
|
38
|
+
if not isinstance(filename, str) or not filename.strip():
|
39
|
+
raise ValueError('Filename must be a non-empty string.')
|
40
|
+
self.__filename = filename
|
41
|
+
|
42
|
+
# Validate result input
|
43
|
+
if not isinstance(result, (dict, list)):
|
44
|
+
raise ValueError('Result must be a dictionary or a list.')
|
33
45
|
self.__result = result
|
34
|
-
|
46
|
+
|
47
|
+
# Validate storage_path input
|
48
|
+
if not isinstance(storage_path, (str, Path)):
|
49
|
+
raise ValueError('Storage path must be a string or a Path object.')
|
35
50
|
self.__storage_path = storage_path
|
36
51
|
|
52
|
+
# Validate persist input
|
53
|
+
if not isinstance(persist, bool):
|
54
|
+
raise ValueError('Persist must be a boolean value.')
|
55
|
+
self.__persist = persist
|
56
|
+
|
37
57
|
# Ensure storage_path is a Path object and create the directory if it doesn't exist
|
38
|
-
storage_dir = Path(storage_path)
|
58
|
+
storage_dir = Path(storage_path) if isinstance(storage_path, str) else storage_path
|
39
59
|
storage_dir.mkdir(parents=True, exist_ok=True)
|
40
60
|
|
41
61
|
# Set the absolute path for the report file
|
@@ -45,24 +65,35 @@ class TestingResultRender(ITestingResultRender):
|
|
45
65
|
self
|
46
66
|
) -> str:
|
47
67
|
"""
|
48
|
-
|
68
|
+
Generates an HTML report from the test results and writes it to a file.
|
49
69
|
|
50
|
-
|
51
|
-
|
52
|
-
placeholders with the test results and persistence mode, writes the rendered content to a report file,
|
70
|
+
Depending on the persistence mode, the report will include either the current in-memory test result
|
71
|
+
or the last 10 persisted test results from the database. The method reads an HTML template file,
|
72
|
+
replaces placeholders with the test results and persistence mode, writes the rendered content to a report file,
|
53
73
|
and attempts to open the report in the default web browser on supported platforms.
|
54
74
|
|
75
|
+
Parameters
|
76
|
+
----------
|
77
|
+
self : TestingResultRender
|
78
|
+
Instance of the TestingResultRender class.
|
79
|
+
|
55
80
|
Returns
|
56
81
|
-------
|
57
82
|
str
|
58
83
|
The absolute path to the generated HTML report file.
|
84
|
+
|
85
|
+
Notes
|
86
|
+
-----
|
87
|
+
- If persistence is enabled, the last 10 test reports are retrieved from the database and included in the report.
|
88
|
+
- If persistence is disabled, only the current test result is included.
|
89
|
+
- The report is automatically opened in the default web browser on Windows and macOS platforms.
|
59
90
|
"""
|
91
|
+
|
60
92
|
# Determine the source of test results based on persistence mode
|
61
93
|
if self.__persist:
|
62
94
|
|
63
95
|
# If persistence is enabled, fetch the last 10 reports from SQLite
|
64
|
-
|
65
|
-
reports = logs.get(last=10)
|
96
|
+
reports = TestLogs(self.__storage_path).get(last=10)
|
66
97
|
|
67
98
|
# Parse each report's JSON data into a list
|
68
99
|
results_list = [json.loads(report[1]) for report in reports]
|
@@ -97,13 +128,10 @@ class TestingResultRender(ITestingResultRender):
|
|
97
128
|
|
98
129
|
# Open the generated report in the default web browser if running on Windows or macOS.
|
99
130
|
try:
|
100
|
-
|
101
131
|
# Check the operating system and open the report in a web browser if applicable
|
102
132
|
if ((os.name == 'nt') or (os.name == 'posix' and sys.platform == 'darwin')):
|
103
133
|
import webbrowser
|
104
134
|
webbrowser.open(self.__report_path.as_uri())
|
105
|
-
|
106
135
|
finally:
|
107
|
-
|
108
136
|
# Return the absolute path to the generated report
|
109
137
|
return str(self.__report_path)
|
@@ -217,7 +217,7 @@ orionis/foundation/providers/scheduler_provider.py,sha256=irwkjMiq-HpsbJxAOnhjji
|
|
217
217
|
orionis/foundation/providers/testing_provider.py,sha256=2akFnabtH_cV_7z_2cCL7u8cPCGvCJAmlhMcnlCrc4c,3742
|
218
218
|
orionis/foundation/providers/workers_provider.py,sha256=P_YtJuPNrdJAQJkAqI11KI0c6GSB9NqIuuCKpRytE0g,3937
|
219
219
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
220
|
-
orionis/metadata/framework.py,sha256=
|
220
|
+
orionis/metadata/framework.py,sha256=ip6JaD0K5V1Nr2jamVLSIj9neaJh7Hg-KeuFaQc4QUw,4109
|
221
221
|
orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
|
222
222
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
223
223
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -370,9 +370,9 @@ orionis/test/contracts/logs.py,sha256=kRH3TGQcTNI0kRxFyEs13Y7NOPP9x9WGitPexnoLzQ
|
|
370
370
|
orionis/test/contracts/printer.py,sha256=iBz8wHAGaS21VBsHlZQVcx0xu9Bqusb-CLAjj-R1Sjg,3412
|
371
371
|
orionis/test/contracts/render.py,sha256=wpDQzUtT0r8KFZ7zPcxWHXQ1EVNKxzA_rZ6ZKUcZO1c,744
|
372
372
|
orionis/test/contracts/test_result.py,sha256=SNXJ2UerkweYn7uCT0i0HmMGP0XBrL_9KJs-0ZvIYU4,4002
|
373
|
-
orionis/test/contracts/unit_test.py,sha256=
|
373
|
+
orionis/test/contracts/unit_test.py,sha256=6DG8rqhBSvTf3lwtmzyO_xci_V-9WxBP6ZibATeQ3Gw,589
|
374
374
|
orionis/test/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
375
|
-
orionis/test/core/unit_test.py,sha256=
|
375
|
+
orionis/test/core/unit_test.py,sha256=rGesBj6cPRCBvfpWPXijK0pqFZ9OqRxcuZbGTAhRq7E,72853
|
376
376
|
orionis/test/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
377
377
|
orionis/test/entities/result.py,sha256=eZ6UIqGmFW8FZ9x8PB_MZbLAc-SAuUyi4FUcMYIZzGo,4777
|
378
378
|
orionis/test/enums/__init__.py,sha256=M3imAgMvKFTKg55FbtVoY3zxj7QRY9AfaUWxiSZVvn4,66
|
@@ -385,9 +385,9 @@ orionis/test/exceptions/runtime.py,sha256=h9gQ0pS8tJTmuXNG-GHky8tTqpdz-cNqkntOOl
|
|
385
385
|
orionis/test/exceptions/value.py,sha256=CoqYOkViU_RaKCMNpB82tgEsR3XhI1pw6YQ8sH8CJh4,588
|
386
386
|
orionis/test/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
387
387
|
orionis/test/output/dumper.py,sha256=qJDyVvl3MO0Uinr6z9TYYdDTqHNwwM0PcoDNNkTpAnA,5908
|
388
|
-
orionis/test/output/printer.py,sha256=
|
388
|
+
orionis/test/output/printer.py,sha256=tWj0lMYD3LTeJ9q_kzgJpXc9w0qJxDwHwoEl_0SzD-4,27508
|
389
389
|
orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
390
|
-
orionis/test/records/logs.py,sha256=
|
390
|
+
orionis/test/records/logs.py,sha256=N5MczDDZ8HqyTCLgb4ikzAQzyzl2JhKHNVd-KGzAG20,22081
|
391
391
|
orionis/test/validators/__init__.py,sha256=2e862DM9aRnPajv2nxMujewe9dZ-1PyCamJKDcF-hGc,944
|
392
392
|
orionis/test/validators/base_path.py,sha256=wAn5_HG0vQ5GH7wDKriO33Ijl1L1F3882BH67oraJnQ,1477
|
393
393
|
orionis/test/validators/execution_mode.py,sha256=YnrQlnIaoPtM0xjW7jJ2170m1aHwAPPIZBjSVe9g2QM,1693
|
@@ -404,10 +404,10 @@ orionis/test/validators/verbosity.py,sha256=rADzM82cPcJ2_6crszpobJuwb5WihWNQf6i4
|
|
404
404
|
orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNusHqc02R8,853
|
405
405
|
orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
|
406
406
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
407
|
-
orionis/test/view/render.py,sha256=
|
407
|
+
orionis/test/view/render.py,sha256=R55ykeRs0wDKcdTf4O1YZ8GDHTFmJ0IK6VQkbJkYUvo,5571
|
408
408
|
orionis/test/view/report.stub,sha256=QLqqCdRoENr3ECiritRB3DO_MOjRQvgBh5jxZ3Hs1r0,28189
|
409
|
-
orionis-0.
|
410
|
-
orionis-0.
|
411
|
-
orionis-0.
|
412
|
-
orionis-0.
|
413
|
-
orionis-0.
|
409
|
+
orionis-0.592.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
|
410
|
+
orionis-0.592.0.dist-info/METADATA,sha256=HNQVi6xUNecxxbdaPr8EeQ-FTrD3nAHZKs_LYP1pi58,4801
|
411
|
+
orionis-0.592.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
412
|
+
orionis-0.592.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
|
413
|
+
orionis-0.592.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|