orionis 0.591.0__py3-none-any.whl → 0.593.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.
@@ -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 the TestingResultRender instance.
18
+ Initializes a TestingResultRender instance for rendering test results into an HTML report.
18
19
 
19
20
  Parameters
20
21
  ----------
21
- result : Any
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
- self.__filename = 'orionis-test-results.html'
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
- self.__persist = persist
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
- Renders the test results into an HTML report file.
68
+ Generates an HTML report from the test results and writes it to a file.
49
69
 
50
- If persistence is enabled, retrieves the last 10 reports from the database and includes them in the report.
51
- Otherwise, only the current in-memory test result is used. The method reads a template file, replaces
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
- logs = TestLogs(self.__storage_path)
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.591.0
3
+ Version: 0.593.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -191,7 +191,7 @@ orionis/foundation/config/session/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-
191
191
  orionis/foundation/config/session/helpers/secret_key.py,sha256=yafjzQ9KVQdXzCQCMthpgizlNCo5F5UTLtAnInipUMk,447
192
192
  orionis/foundation/config/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
193
193
  orionis/foundation/config/testing/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
194
- orionis/foundation/config/testing/entities/testing.py,sha256=bXT1VMXvZQc2rs2x0s3PNVuHSaoDYLBUq7LfK1BcZYs,12204
194
+ orionis/foundation/config/testing/entities/testing.py,sha256=OkgaZ4lCeU3bTUUVHl73PEbdlXjMsI16iuD9Pwkc5vg,11587
195
195
  orionis/foundation/config/testing/enums/__init__.py,sha256=aFh5kBxlh5kqHK-9W7qgdykF5-qou5SVRzorRBazqYw,196
196
196
  orionis/foundation/config/testing/enums/drivers.py,sha256=mwv47FcKDXEOxydQXAGtkdIY9S6qCAW1cD22oCFy3xw,355
197
197
  orionis/foundation/config/testing/enums/mode.py,sha256=IbFpauu7J-iSAfmC8jDbmTEYl8eZr-AexL-lyOh8_74,337
@@ -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=ljgJkH88KVq9vm8hJRj5c9Z2hhdDtOlaXgdH3XDgk6c,4109
220
+ orionis/metadata/framework.py,sha256=s6s0dYCwOfjVO09Leal7YLnkxZ0CYqHnEB3e5xJ3E-E,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=hOuMgm1JVk3ERLrpMnDhShMWCJCJBdgOsY-U6kPaO0k,2335
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=Yqn_Q-aM0-x2zzsnB-h3XBGg20iCrn1pkT1UFI-L0RE,65105
375
+ orionis/test/core/unit_test.py,sha256=U5HT1a6s-Wosz5BC7Pi5cPreRyLzFJWbEoKWw7jdvvY,72957
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=Ho8jyhnJsvnJ5zdHbXyvY29kDa1zp4FsCswjt9XSeJ4,23903
388
+ orionis/test/output/printer.py,sha256=M33HhDQBRxB-C-myOqPFSkTvfLyDCc424uVqJg40NYc,29575
389
389
  orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
390
- orionis/test/records/logs.py,sha256=7XIdzDmQpb2HLUoAUWVj8UKiQDOnCkLD7ttro-Lv5UY,14223
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=1FJHFBRHbwI5FV90F9-cMUmT10xrA5tc2bY1ysTzD-8,4094
407
+ orionis/test/view/render.py,sha256=R55ykeRs0wDKcdTf4O1YZ8GDHTFmJ0IK6VQkbJkYUvo,5571
408
408
  orionis/test/view/report.stub,sha256=QLqqCdRoENr3ECiritRB3DO_MOjRQvgBh5jxZ3Hs1r0,28189
409
- orionis-0.591.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
410
- orionis-0.591.0.dist-info/METADATA,sha256=AoYGMXmT2rzsE_bYDenQjpDFW12CiZHzvB3lNZXqeeM,4801
411
- orionis-0.591.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
412
- orionis-0.591.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
413
- orionis-0.591.0.dist-info/RECORD,,
409
+ orionis-0.593.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
410
+ orionis-0.593.0.dist-info/METADATA,sha256=O3C-w6zuLT6bsvYt-y-TlgqIw03W_A9EQ17OadTCTdc,4801
411
+ orionis-0.593.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
412
+ orionis-0.593.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
413
+ orionis-0.593.0.dist-info/RECORD,,