orionis 0.302.0__py3-none-any.whl → 0.304.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.304.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,5 +1,5 @@
1
1
  from abc import ABC, abstractmethod
2
- from orionis.test.suites.test_unit import UnitTest
2
+ from orionis.test.suite.test_unit import UnitTest
3
3
 
4
4
  class ITestSuite(ABC):
5
5
 
@@ -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
@@ -2,8 +2,8 @@ import re
2
2
  from os import walk
3
3
  from orionis.foundation.config.testing.entities.testing import Testing as Configuration
4
4
  from orionis.test.exceptions.test_config_exception import OrionisTestConfigException
5
- from orionis.test.suites.contracts.test_suite import ITestSuite
6
- from orionis.test.suites.test_unit import UnitTest
5
+ from orionis.test.facade.contracts.test_suite import ITestSuite
6
+ from orionis.test.suite.test_unit import UnitTest
7
7
 
8
8
  class TestSuite(ITestSuite):
9
9
  """
@@ -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
File without changes
File without changes
@@ -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
@@ -25,7 +25,7 @@ from orionis.test.exceptions.test_failure_exception import OrionisTestFailureExc
25
25
  from orionis.test.exceptions.test_persistence_error import OrionisTestPersistenceError
26
26
  from orionis.test.exceptions.test_value_error import OrionisTestValueError
27
27
  from orionis.test.logs.history import TestHistory
28
- from orionis.test.suites.contracts.test_unit import IUnitTest
28
+ from orionis.test.suite.contracts.test_unit import IUnitTest
29
29
  from orionis.test.view.render import TestingResultRender
30
30
 
31
31
  class UnitTest(IUnitTest):
@@ -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.")
orionis/unittesting.py CHANGED
@@ -21,8 +21,8 @@ from orionis.test.exceptions.test_runtime_error import OrionisTestRuntimeError
21
21
  from orionis.test.exceptions.test_value_error import OrionisTestValueError
22
22
 
23
23
  # Import configuration and suite classes for organizing tests
24
- from orionis.test.suites.test_suite import Configuration, TestSuite
25
- from orionis.test.suites.test_unit import UnitTest
24
+ from orionis.test.facade.test_suite import Configuration, TestSuite
25
+ from orionis.test.suite.test_unit import UnitTest
26
26
 
27
27
  # Import standard unittest components for compatibility
28
28
  from unittest import (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.302.0
3
+ Version: 0.304.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
@@ -1,7 +1,7 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/_application.py,sha256=dMjJ0nFcIIOBGb5zr-tHNzcgTOZ1vJ7iMdFAlqSQph0,9405
3
3
  orionis/application.py,sha256=Off5uOUj-IYvvR8DcqLUoBW_98opWa7MQrtqTr0SZGc,292
4
- orionis/unittesting.py,sha256=-g3iYvdsZeuPFocjxx-z9KpzYl7CN14LvMhprY-Rm8s,2102
4
+ orionis/unittesting.py,sha256=8Pz0h4qJO4CpSi35J7SiD-Z6QGpyd22M_ckmG2u3k-M,2101
5
5
  orionis/_container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  orionis/_container/container.py,sha256=0AOqTNwpN_OtWbq9mBI99qfJ7LMkN71y0lP0JWKzut0,18289
7
7
  orionis/_container/container_integrity.py,sha256=vrqZrkJaP6ghbiAzr-nEul9f_lEWVa2nMUSugQXDfWk,10095
@@ -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=j05Uu1wPibe4qopb29LLL4xurPPPXK6OgNyHWHzJWhQ,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
@@ -349,6 +349,10 @@ orionis/test/exceptions/test_failure_exception.py,sha256=IwmBRiDMAJ4Jk75-kfQh5mW
349
349
  orionis/test/exceptions/test_persistence_error.py,sha256=QJ2hdVAl6ngZEko0mSavU7nui8si7ZXR9PUXfU9cOY0,724
350
350
  orionis/test/exceptions/test_runtime_error.py,sha256=QahR7qHhvzR1I8CS-qWsxL_c0lSzWWE1rCiwf47YRQc,523
351
351
  orionis/test/exceptions/test_value_error.py,sha256=XZmxiZmmMoYoh8O4V97GLB-Ooh-IRVagKW9bWPvtoeo,533
352
+ orionis/test/facade/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
353
+ orionis/test/facade/test_suite.py,sha256=pxsxbok_MbPxnsfcfwwI32ltbnL9NByA_YETFRRP4QY,5018
354
+ orionis/test/facade/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
355
+ orionis/test/facade/contracts/test_suite.py,sha256=6BBEHFgIAMkOWiKo5k5l2SR1JCNCZ-iJEQUl7PQCiAc,794
352
356
  orionis/test/logs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
353
357
  orionis/test/logs/history.py,sha256=YqoAQSYyEo9PQSbB7TsHZy3SLKrwLsgyiKu7t2M7ztc,13149
354
358
  orionis/test/logs/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -357,18 +361,16 @@ orionis/test/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
357
361
  orionis/test/output/dumper.py,sha256=y-6du3n1IU2Cd2MFbMuEiLcpMqEOqENkuAXwMMhcsEI,4287
358
362
  orionis/test/output/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
363
  orionis/test/output/contracts/dumper.py,sha256=5OqGc4GEXCXX76sCX185giQMyKwwZvlOv3I7tTwV2fQ,1324
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
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/suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
365
+ orionis/test/suite/test_unit.py,sha256=q6cEHnuCM8VlGP45_kiEWDmGn4RHSkBo7DbFpS1fKRI,57055
366
+ orionis/test/suite/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
367
+ orionis/test/suite/contracts/test_unit.py,sha256=YWpzXhjD-f-IGncKkGyE9C7tYCFbt9mxZPw1O_d5HOE,7532
366
368
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
367
369
  orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
368
- orionis-0.302.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
370
+ orionis-0.304.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
369
371
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
370
372
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
371
- tests/example/test_example.py,sha256=k6wYRMEQ-ntzr6SIp1KFhKxWVrq3nLUKsJmT3m7JNuw,601
373
+ tests/example/test_example.py,sha256=kvWgiW3ADEZf718dGsMPtDh_rmOSx1ypEInKm7_6ZPQ,601
372
374
  tests/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
373
375
  tests/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
374
376
  tests/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -469,8 +471,8 @@ tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py,sha256=
469
471
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
470
472
  tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
471
473
  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,,
474
+ orionis-0.304.0.dist-info/METADATA,sha256=7p2zsIXZrMLaG6tY0fpGfgGBvBBK7OF0yqktjaioAMs,4772
475
+ orionis-0.304.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
476
+ orionis-0.304.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
477
+ orionis-0.304.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
478
+ orionis-0.304.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)
File without changes
File without changes