orionis 0.302.0__py3-none-any.whl → 0.303.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.
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.302.0"
8
+ VERSION = "0.303.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -22,16 +22,4 @@ class ITestSuite(ABC):
22
22
  OrionisTestConfigException
23
23
  If the provided configuration is not an instance of Configuration.
24
24
  """
25
- pass
26
-
27
- @abstractmethod
28
- def getResult(self) -> UnitTest:
29
- """
30
- Returns the results of the executed test suite.
31
-
32
- Returns
33
- -------
34
- UnitTest
35
- The result of the executed test suite.
36
- """
37
25
  pass
@@ -14,7 +14,8 @@ class IUnitTest(ABC):
14
14
  print_result: bool = None,
15
15
  throw_exception: bool = False,
16
16
  persistent: bool = False,
17
- persistent_driver: str = 'sqlite'
17
+ persistent_driver: str = 'sqlite',
18
+ web_report: bool = False
18
19
  ):
19
20
  """
20
21
  Configures the UnitTest instance with the specified parameters.
@@ -163,4 +164,56 @@ class IUnitTest(ABC):
163
164
 
164
165
  Resets the internal test suite to an empty `unittest.TestSuite`, removing any previously added tests.
165
166
  """
167
+ pass
168
+
169
+ @abstractmethod
170
+ def getResult(self) -> dict:
171
+ """
172
+ Returns the results of the executed test suite.
173
+
174
+ Returns
175
+ -------
176
+ UnitTest
177
+ The result of the executed test suite.
178
+ """
179
+ pass
180
+
181
+ @abstractmethod
182
+ def getOutputBuffer(self) -> int:
183
+ """
184
+ Returns the output buffer used for capturing test results.
185
+ This method returns the internal output buffer that collects the results of the test execution.
186
+ Returns
187
+ -------
188
+ int
189
+ The output buffer containing the results of the test execution.
190
+ """
191
+ pass
192
+
193
+ @abstractmethod
194
+ def printOutputBuffer(self) -> None:
195
+ """
196
+ Prints the contents of the output buffer to the console.
197
+ This method retrieves the output buffer and prints its contents using the rich console.
198
+ """
199
+ pass
200
+
201
+ @abstractmethod
202
+ def getErrorBuffer(self) -> int:
203
+ """
204
+ Returns the error buffer used for capturing test errors.
205
+ This method returns the internal error buffer that collects any errors encountered during test execution.
206
+ Returns
207
+ -------
208
+ int
209
+ The error buffer containing the errors encountered during the test execution.
210
+ """
211
+ pass
212
+
213
+ @abstractmethod
214
+ def printErrorBuffer(self) -> None:
215
+ """
216
+ Prints the contents of the error buffer to the console.
217
+ This method retrieves the error buffer and prints its contents using the rich console.
218
+ """
166
219
  pass
@@ -39,9 +39,8 @@ class TestSuite(ITestSuite):
39
39
  Configuration object specifying parameters for test suite execution. If not provided, a new Configuration instance is created.
40
40
  """
41
41
  self.__config = config or Configuration()
42
- self.__result = None
43
42
 
44
- def run(self) -> UnitTest:
43
+ def run(self) -> 'UnitTest':
45
44
  """
46
45
  Runs the test suite based on the provided configuration.
47
46
 
@@ -119,17 +118,6 @@ class TestSuite(ITestSuite):
119
118
  tags=config.tags if config.tags else None
120
119
  )
121
120
 
122
- # Return the initialized test suite
123
- self.__result = tests.run()
124
- return self
125
-
126
- def getResult(self) -> UnitTest:
127
- """
128
- Returns the results of the executed test suite.
129
-
130
- Returns
131
- -------
132
- UnitTest
133
- The result of the executed test suite.
134
- """
135
- return self.__result
121
+ # Run the test suite and return the UnitTest instance
122
+ tests.run()
123
+ return tests
@@ -134,6 +134,9 @@ class UnitTest(IUnitTest):
134
134
  self.web_report: bool = False
135
135
  self.base_path: str = "tests"
136
136
  self.withliveconsole: bool = True
137
+ self.__output_buffer = None
138
+ self.__error_buffer = None
139
+ self.__result = None
137
140
 
138
141
  def configure(
139
142
  self,
@@ -408,31 +411,34 @@ class UnitTest(IUnitTest):
408
411
  self._startMessage()
409
412
 
410
413
  # Prepare the running message based on whether live console is enabled
411
- message = "[bold yellow]⏳ Running tests...[/bold yellow]\n"
412
- message += "[dim]This may take a few seconds. Please wait...[/dim]" if self.withliveconsole else "[dim]Please wait, results will appear below...[/dim]"
413
-
414
- # Panel for running message
415
- running_panel = Panel(
416
- message,
417
- border_style="yellow",
418
- title="In Progress",
419
- title_align="left",
420
- width=self.width_output_component,
421
- padding=(1, 2)
422
- )
414
+ if self.print_result:
415
+ message = "[bold yellow] Running tests...[/bold yellow]\n"
416
+ message += "[dim]This may take a few seconds. Please wait...[/dim]" if self.withliveconsole else "[dim]Please wait, results will appear below...[/dim]"
417
+
418
+ # Panel for running message
419
+ running_panel = Panel(
420
+ message,
421
+ border_style="yellow",
422
+ title="In Progress",
423
+ title_align="left",
424
+ width=self.width_output_component,
425
+ padding=(1, 2)
426
+ )
423
427
 
424
- # Elegant "running" message using Rich Panel
425
- if self.withliveconsole:
426
- with Live(running_panel, console=self.rich_console, refresh_per_second=4, transient=True):
428
+ # Elegant "running" message using Rich Panel
429
+ if self.withliveconsole:
430
+ with Live(running_panel, console=self.rich_console, refresh_per_second=4, transient=True):
431
+ result, output_buffer, error_buffer = self._runSuite()
432
+ else:
433
+ self.rich_console.print(running_panel)
427
434
  result, output_buffer, error_buffer = self._runSuite()
428
435
  else:
429
- self.rich_console.print(running_panel)
436
+ # If not printing results, run the suite without live console
430
437
  result, output_buffer, error_buffer = self._runSuite()
431
438
 
432
- # Capture and display the output and error buffers only if not empty
433
- output_content = output_buffer.getvalue()
434
- if output_content.strip():
435
- print(output_buffer.getvalue())
439
+ # Save Outputs
440
+ self.__output_buffer = output_buffer.getvalue()
441
+ self.__error_buffer = error_buffer.getvalue()
436
442
 
437
443
  # Process results
438
444
  execution_time = time.time() - self.start_time
@@ -447,6 +453,7 @@ class UnitTest(IUnitTest):
447
453
  raise OrionisTestFailureException(result)
448
454
 
449
455
  # Return the summary of the test results
456
+ self.__result = summary
450
457
  return summary
451
458
 
452
459
  def _withLiveConsole(self) -> None:
@@ -1366,4 +1373,57 @@ class UnitTest(IUnitTest):
1366
1373
 
1367
1374
  Resets the internal test suite to an empty `unittest.TestSuite`, removing any previously added tests.
1368
1375
  """
1369
- self.suite = unittest.TestSuite()
1376
+ self.suite = unittest.TestSuite()
1377
+
1378
+ def getResult(self) -> dict:
1379
+ """
1380
+ Returns the results of the executed test suite.
1381
+
1382
+ Returns
1383
+ -------
1384
+ UnitTest
1385
+ The result of the executed test suite.
1386
+ """
1387
+ return self.__result
1388
+
1389
+ def getOutputBuffer(self) -> int:
1390
+ """
1391
+ Returns the output buffer used for capturing test results.
1392
+ This method returns the internal output buffer that collects the results of the test execution.
1393
+ Returns
1394
+ -------
1395
+ int
1396
+ The output buffer containing the results of the test execution.
1397
+ """
1398
+ return self.__output_buffer
1399
+
1400
+ def printOutputBuffer(self) -> None:
1401
+ """
1402
+ Prints the contents of the output buffer to the console.
1403
+ This method retrieves the output buffer and prints its contents using the rich console.
1404
+ """
1405
+ if self.__output_buffer:
1406
+ print(self.__output_buffer)
1407
+ else:
1408
+ print("No output buffer available.")
1409
+
1410
+ def getErrorBuffer(self) -> int:
1411
+ """
1412
+ Returns the error buffer used for capturing test errors.
1413
+ This method returns the internal error buffer that collects any errors encountered during test execution.
1414
+ Returns
1415
+ -------
1416
+ int
1417
+ The error buffer containing the errors encountered during the test execution.
1418
+ """
1419
+ return self.__error_buffer
1420
+
1421
+ def printErrorBuffer(self) -> None:
1422
+ """
1423
+ Prints the contents of the error buffer to the console.
1424
+ This method retrieves the error buffer and prints its contents using the rich console.
1425
+ """
1426
+ if self.__error_buffer:
1427
+ print(self.__error_buffer)
1428
+ else:
1429
+ print("No error buffer available.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.302.0
3
+ Version: 0.303.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
@@ -226,7 +226,7 @@ orionis/foundation/config/testing/entities/testing.py,sha256=AuhPU9O15Aeqs8jQVHW
226
226
  orionis/foundation/config/testing/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
227
  orionis/foundation/config/testing/enums/test_mode.py,sha256=IbFpauu7J-iSAfmC8jDbmTEYl8eZr-AexL-lyOh8_74,337
228
228
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
- orionis/metadata/framework.py,sha256=cKXBCBoLPBXiQ6LZ7ghbe8MWVFfuG0Caa85ZhtiYLTM,4960
229
+ orionis/metadata/framework.py,sha256=kIoAY-9EIV8ft4wGLndURXqO2u7xS8JlYni6JmXISSY,4960
230
230
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
231
231
  orionis/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
232
232
  orionis/patterns/singleton/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -358,17 +358,17 @@ orionis/test/output/dumper.py,sha256=y-6du3n1IU2Cd2MFbMuEiLcpMqEOqENkuAXwMMhcsEI
358
358
  orionis/test/output/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
359
  orionis/test/output/contracts/dumper.py,sha256=5OqGc4GEXCXX76sCX185giQMyKwwZvlOv3I7tTwV2fQ,1324
360
360
  orionis/test/suites/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
361
- orionis/test/suites/test_suite.py,sha256=nJhToYdvHFETSNqunk-_i6Pe716842eaFKDBhChjigA,5303
362
- orionis/test/suites/test_unit.py,sha256=dnLEEeBnGkE7DRM2XXJPtxHw25JLzP9ZtcGImmBNBM4,54916
361
+ orionis/test/suites/test_suite.py,sha256=_EJ1xgCOc5MDp3bDI9bAqjCdoMPl8-UITeLClBPgtoE,5019
362
+ orionis/test/suites/test_unit.py,sha256=KFt2wnt1NBJnH8EZtET9hCVgIQYxVFBpG-jrvHlxXPI,57056
363
363
  orionis/test/suites/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
364
- orionis/test/suites/contracts/test_suite.py,sha256=eluzYwkNBbKjxYStj_tHN_Fm3YDPpGQdqMu5eiluh-E,1059
365
- orionis/test/suites/contracts/test_unit.py,sha256=l1LQllODyvcSByXMl1lGrUkoLsXbBHZZLWZI4A-mlQg,5881
364
+ orionis/test/suites/contracts/test_suite.py,sha256=LynUESckdIjgqG4VzyObS-lS47uDxIIVqD9Ja5oPj1M,795
365
+ orionis/test/suites/contracts/test_unit.py,sha256=YWpzXhjD-f-IGncKkGyE9C7tYCFbt9mxZPw1O_d5HOE,7532
366
366
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
367
367
  orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
368
- orionis-0.302.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
368
+ orionis-0.303.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
369
369
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
370
370
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
371
- tests/example/test_example.py,sha256=k6wYRMEQ-ntzr6SIp1KFhKxWVrq3nLUKsJmT3m7JNuw,601
371
+ tests/example/test_example.py,sha256=kvWgiW3ADEZf718dGsMPtDh_rmOSx1ypEInKm7_6ZPQ,601
372
372
  tests/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
373
373
  tests/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
374
374
  tests/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -469,8 +469,8 @@ tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py,sha256=
469
469
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
470
470
  tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
471
471
  tests/testing/test_testing_unit.py,sha256=A6QkiOkP7GPC1Szh_GqsrV7GxjWjK8cIwFez6YfrzmM,7683
472
- orionis-0.302.0.dist-info/METADATA,sha256=JimB10OhnB9KCPYmZg9Xm5dX--Jn6kK1p0X3wnCig-k,4772
473
- orionis-0.302.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
474
- orionis-0.302.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
475
- orionis-0.302.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
476
- orionis-0.302.0.dist-info/RECORD,,
472
+ orionis-0.303.0.dist-info/METADATA,sha256=3ZdPn1u-dHQHBN_Fbv38L2YTQXbYR2h3Wju1V7ur2rU,4772
473
+ orionis-0.303.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
474
+ orionis-0.303.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
475
+ orionis-0.303.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
476
+ orionis-0.303.0.dist-info/RECORD,,
@@ -17,7 +17,7 @@ class TestExample(TestCase):
17
17
  Ensures that the integer 2 is equal to itself.
18
18
  """
19
19
  # Check if 1 equals 1
20
- self.assertEqual(1, 1)
20
+ self.assertEqual(2, 2)
21
21
 
22
22
  # Check if 2 equals 2
23
23
  self.assertEqual(3, 3)