orionis 0.587.0__py3-none-any.whl → 0.589.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/foundation/application.py +52 -13
- orionis/foundation/config/testing/entities/testing.py +0 -23
- orionis/foundation/contracts/application.py +27 -0
- orionis/metadata/framework.py +1 -1
- orionis/test/contracts/unit_test.py +0 -156
- orionis/test/core/unit_test.py +339 -402
- orionis/test/kernel.py +45 -60
- orionis/test/validators/__init__.py +0 -2
- {orionis-0.587.0.dist-info → orionis-0.589.0.dist-info}/METADATA +1 -1
- {orionis-0.587.0.dist-info → orionis-0.589.0.dist-info}/RECORD +13 -14
- orionis/test/validators/tags.py +0 -36
- {orionis-0.587.0.dist-info → orionis-0.589.0.dist-info}/WHEEL +0 -0
- {orionis-0.587.0.dist-info → orionis-0.589.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.587.0.dist-info → orionis-0.589.0.dist-info}/top_level.txt +0 -0
orionis/test/kernel.py
CHANGED
@@ -2,7 +2,6 @@ from orionis.foundation.contracts.application import IApplication
|
|
2
2
|
from orionis.services.log.contracts.log_service import ILogger
|
3
3
|
from orionis.test.contracts.kernel import ITestKernel
|
4
4
|
from orionis.test.contracts.unit_test import IUnitTest
|
5
|
-
from orionis.foundation.config.testing.entities.testing import Testing
|
6
5
|
from orionis.test.exceptions import OrionisTestConfigException
|
7
6
|
|
8
7
|
class TestKernel(ITestKernel):
|
@@ -12,94 +11,80 @@ class TestKernel(ITestKernel):
|
|
12
11
|
app: IApplication
|
13
12
|
) -> None:
|
14
13
|
"""
|
15
|
-
Initialize the TestKernel with the provided application
|
14
|
+
Initialize the TestKernel instance with the provided application.
|
16
15
|
|
17
|
-
This constructor
|
18
|
-
|
16
|
+
This constructor validates the given application instance and sets up
|
17
|
+
the test kernel by resolving required dependencies for unit testing.
|
18
|
+
It ensures that the application parameter is of the correct type and
|
19
|
+
retrieves the unit test service from the application's dependency container.
|
19
20
|
|
20
21
|
Parameters
|
21
22
|
----------
|
22
23
|
app : IApplication
|
23
|
-
The application instance
|
24
|
-
|
24
|
+
The application instance responsible for dependency injection and
|
25
|
+
service resolution.
|
25
26
|
|
26
27
|
Raises
|
27
28
|
------
|
28
29
|
OrionisTestConfigException
|
29
|
-
If the provided app parameter is not an instance of IApplication
|
30
|
+
If the provided `app` parameter is not an instance of `IApplication`.
|
30
31
|
|
31
32
|
Returns
|
32
33
|
-------
|
33
34
|
None
|
34
|
-
This
|
35
|
+
This constructor does not return any value.
|
35
36
|
"""
|
36
|
-
|
37
|
+
|
38
|
+
# Ensure the provided app is a valid IApplication instance
|
37
39
|
if not isinstance(app, IApplication):
|
38
40
|
raise OrionisTestConfigException(
|
39
41
|
f"Failed to initialize TestKernel: expected IApplication, got {type(app).__module__}.{type(app).__name__}."
|
40
42
|
)
|
41
43
|
|
42
|
-
#
|
43
|
-
|
44
|
+
# Store the application instance for later use
|
45
|
+
self.__app: IApplication = app
|
44
46
|
|
45
|
-
#
|
47
|
+
# Retrieve the unit test service from the application container
|
46
48
|
self.__unit_test: IUnitTest = app.make(IUnitTest)
|
47
49
|
|
48
|
-
|
49
|
-
self.__unit_test.configure(
|
50
|
-
verbosity=config.verbosity, # Set output verbosity level
|
51
|
-
execution_mode=config.execution_mode, # Configure test execution mode
|
52
|
-
max_workers=config.max_workers, # Set maximum worker threads for parallel execution
|
53
|
-
fail_fast=config.fail_fast, # Enable/disable fail-fast behavior
|
54
|
-
print_result=config.print_result, # Control result output printing
|
55
|
-
throw_exception=config.throw_exception, # Configure exception throwing behavior
|
56
|
-
persistent=config.persistent, # Enable/disable persistent test results
|
57
|
-
persistent_driver=config.persistent_driver, # Set persistent storage driver
|
58
|
-
web_report=config.web_report # Enable/disable web-based reporting
|
59
|
-
)
|
60
|
-
|
61
|
-
# Discover and load test files based on configuration criteria
|
62
|
-
self.__unit_test.discoverTests(
|
63
|
-
base_path=app.path('tests'), # Base directory for test discovery
|
64
|
-
folder_path=config.folder_path, # Specific folder path within base_path
|
65
|
-
pattern=config.pattern, # File name pattern for test files
|
66
|
-
test_name_pattern=config.test_name_pattern, # Pattern for test method names
|
67
|
-
tags=config.tags # Tags to filter tests during discovery
|
68
|
-
)
|
69
|
-
|
70
|
-
# Initialize the logger service for logging command execution details
|
71
|
-
self.__logger: ILogger = app.make(ILogger)
|
72
|
-
|
73
|
-
def handle(self) -> IUnitTest:
|
50
|
+
def handle(self) -> dict:
|
74
51
|
"""
|
75
|
-
|
52
|
+
Executes the unit test suite and logs a summary of the results.
|
53
|
+
|
54
|
+
This method serves as the main entry point for running unit tests via the test kernel.
|
55
|
+
It invokes the unit test service, collects the results, and logs a detailed summary
|
56
|
+
including the number of tests, passed, failed, errors, skipped, total execution time,
|
57
|
+
and success rate. If no output is returned, no summary is logged.
|
76
58
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
The method ensures graceful termination of the application in case of any failures.
|
59
|
+
Parameters
|
60
|
+
----------
|
61
|
+
None
|
81
62
|
|
82
63
|
Returns
|
83
64
|
-------
|
84
|
-
|
85
|
-
|
86
|
-
|
65
|
+
dict
|
66
|
+
A dictionary containing the test results summary with keys such as
|
67
|
+
'total_tests', 'passed', 'failed', 'errors', 'skipped', 'total_time',
|
68
|
+
'success_rate', and 'timestamp'. If no tests are run, returns None.
|
87
69
|
"""
|
88
70
|
|
89
|
-
#
|
90
|
-
|
71
|
+
# Run the unit test suite and collect the output summary
|
72
|
+
output = self.__unit_test.run()
|
91
73
|
|
92
|
-
if
|
74
|
+
# Only log detailed report if output is available
|
75
|
+
if output is not None:
|
76
|
+
# Extract report details from output dictionary
|
77
|
+
total_tests = output.get("total_tests", 0)
|
78
|
+
passed = output.get("passed", 0)
|
79
|
+
failed = output.get("failed", 0)
|
80
|
+
errors = output.get("errors", 0)
|
81
|
+
skipped = output.get("skipped", 0)
|
82
|
+
total_time = output.get("total_time", 0)
|
83
|
+
success_rate = output.get("success_rate", 0)
|
84
|
+
timestamp = output.get("timestamp", 0)
|
93
85
|
|
94
|
-
#
|
95
|
-
|
96
|
-
passed = ouput.get("passed")
|
97
|
-
failed = ouput.get("failed")
|
98
|
-
errors = ouput.get("errors")
|
99
|
-
skipped = ouput.get("skipped")
|
100
|
-
total_time = ouput.get("total_time")
|
101
|
-
success_rate = ouput.get("success_rate")
|
102
|
-
timestamp = ouput.get("timestamp")
|
86
|
+
# Resolve the logger service from the application container
|
87
|
+
self.__logger: ILogger = self.__app.make(ILogger)
|
103
88
|
|
104
89
|
# Log test execution completion with detailed summary
|
105
90
|
self.__logger.info(
|
@@ -109,5 +94,5 @@ class TestKernel(ITestKernel):
|
|
109
94
|
f"Time: {total_time:.2f}s, Success rate: {success_rate:.2f}%"
|
110
95
|
)
|
111
96
|
|
112
|
-
#
|
113
|
-
return
|
97
|
+
# Return the test results summary dictionary (or None if no output)
|
98
|
+
return output
|
@@ -8,7 +8,6 @@ from .pattern import ValidPattern
|
|
8
8
|
from .persistent_driver import ValidPersistentDriver
|
9
9
|
from .persistent import ValidPersistent
|
10
10
|
from .print_result import ValidPrintResult
|
11
|
-
from .tags import ValidTags
|
12
11
|
from .throw_exception import ValidThrowException
|
13
12
|
from .verbosity import ValidVerbosity
|
14
13
|
from .web_report import ValidWebReport
|
@@ -25,7 +24,6 @@ __all__ = [
|
|
25
24
|
'ValidPersistentDriver',
|
26
25
|
'ValidPersistent',
|
27
26
|
'ValidPrintResult',
|
28
|
-
'ValidTags',
|
29
27
|
'ValidThrowException',
|
30
28
|
'ValidVerbosity',
|
31
29
|
'ValidWebReport',
|
@@ -103,7 +103,7 @@ orionis/failure/contracts/handler.py,sha256=AeJfkJfD3hTkOIYAtADq6GnQfq-qWgDfUc7b
|
|
103
103
|
orionis/failure/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
104
104
|
orionis/failure/entities/throwable.py,sha256=1zD-awcuAyEtlR-L7V7ZIfPSF4GpXkf-neL5sXul7dc,1240
|
105
105
|
orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
106
|
-
orionis/foundation/application.py,sha256=
|
106
|
+
orionis/foundation/application.py,sha256=_pws-r2QSTTvIonmt9bEBUwOpDvPQkAMNi3IsUpNY8E,82664
|
107
107
|
orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
108
108
|
orionis/foundation/config/startup.py,sha256=btqvryeIf9lLNQ9fBff7bJMrfraEY8qrWi4y_5YAR0Q,9681
|
109
109
|
orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -191,13 +191,13 @@ 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=
|
194
|
+
orionis/foundation/config/testing/entities/testing.py,sha256=bXT1VMXvZQc2rs2x0s3PNVuHSaoDYLBUq7LfK1BcZYs,12204
|
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
|
198
198
|
orionis/foundation/config/testing/enums/verbosity.py,sha256=Z-FQ6C3rxbRwP8HoVibbgRMGcsen2SwTuEy3wnjdIhc,486
|
199
199
|
orionis/foundation/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
200
|
-
orionis/foundation/contracts/application.py,sha256=
|
200
|
+
orionis/foundation/contracts/application.py,sha256=rtvnjAHbPh3fBb7seZWiAc9zF2pxg3w36Q33_keAOcg,46832
|
201
201
|
orionis/foundation/contracts/config.py,sha256=mCyA43f0n_e-CEL0f-sWWgE-M7GicS_aEtC_TNbn_yc,802
|
202
202
|
orionis/foundation/exceptions/__init__.py,sha256=ufomZK6am2-QAaj9peXW549xy_qflcbwj0ECuZz-1Kc,263
|
203
203
|
orionis/foundation/exceptions/application.py,sha256=mr2lVimUEwdYBYQP4PNdVtJ-E39XjPCJXyI-8SRCqtI,205
|
@@ -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=txjk_25DYSonM4bVEfG0F3hPxtu46pq9X86ix4aIOyQ,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
|
@@ -359,7 +359,7 @@ orionis/support/standard/exceptions/standard.py,sha256=BM0VHLRYD7SzoMJkaA7BxY528
|
|
359
359
|
orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
|
360
360
|
orionis/support/wrapper/dot_dict.py,sha256=T8xWwwOhBZHNeXRwE_CxvOwG9UFxsLqNmOJjV2CNIrc,7284
|
361
361
|
orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
362
|
-
orionis/test/kernel.py,sha256=
|
362
|
+
orionis/test/kernel.py,sha256=6yvS0vQBuZ5M2wH2DzTMSRA-judzCK1fnnzkmLfw49w,3970
|
363
363
|
orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
364
364
|
orionis/test/cases/asynchronous.py,sha256=3e1Y3qzIxVU7i7lbLFEVyJ89IA74JsB7famx71W-p2E,1974
|
365
365
|
orionis/test/cases/synchronous.py,sha256=S5jhuDEZ5I9wosrTFaCtowkD5r5HzJH6mKPOdEJcDJE,1734
|
@@ -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=hOuMgm1JVk3ERLrpMnDhShMWCJCJBdgOsY-U6kPaO0k,2335
|
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=mge6EZvfSeZKxSGo6k0-5putfvEByRF-IDAFx-9aSNY,64908
|
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
|
@@ -388,7 +388,7 @@ orionis/test/output/dumper.py,sha256=qJDyVvl3MO0Uinr6z9TYYdDTqHNwwM0PcoDNNkTpAnA
|
|
388
388
|
orionis/test/output/printer.py,sha256=Ho8jyhnJsvnJ5zdHbXyvY29kDa1zp4FsCswjt9XSeJ4,23903
|
389
389
|
orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
390
390
|
orionis/test/records/logs.py,sha256=7XIdzDmQpb2HLUoAUWVj8UKiQDOnCkLD7ttro-Lv5UY,14223
|
391
|
-
orionis/test/validators/__init__.py,sha256=
|
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
|
394
394
|
orionis/test/validators/fail_fast.py,sha256=Z54GSQ2KxYeLy2gZwo51sYYMXH-6mj1w09okhI1MWOQ,850
|
@@ -399,7 +399,6 @@ orionis/test/validators/pattern.py,sha256=NYc_qsjd0Y1J0tmioW7nmlBVowbzkhGA17e4Ad
|
|
399
399
|
orionis/test/validators/persistent.py,sha256=8y6rkseAG4yobbw9AFvVjKlMl2HL_w5i6rH9LNNYZAU,851
|
400
400
|
orionis/test/validators/persistent_driver.py,sha256=9t832vIZyBAdIyKn-nZ-_nKs0Oxf2uvmR7K9ncWdRpw,1545
|
401
401
|
orionis/test/validators/print_result.py,sha256=heUVid49clGfk9-glzVX5NGz69bKqMr0yx2dJnG9rD4,902
|
402
|
-
orionis/test/validators/tags.py,sha256=Qv-p8XFyAjY7OI861s52eADGf3LqzOWYfKt4L1cpo4Q,1118
|
403
402
|
orionis/test/validators/throw_exception.py,sha256=PLtM94BArQf11VJhxfBHJSHARZSia-Q8ePixctU2JwQ,893
|
404
403
|
orionis/test/validators/verbosity.py,sha256=rADzM82cPcJ2_6crszpobJuwb5WihWNQf6i4M_yrCpw,1785
|
405
404
|
orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNusHqc02R8,853
|
@@ -407,8 +406,8 @@ orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnI
|
|
407
406
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
408
407
|
orionis/test/view/render.py,sha256=1FJHFBRHbwI5FV90F9-cMUmT10xrA5tc2bY1ysTzD-8,4094
|
409
408
|
orionis/test/view/report.stub,sha256=QLqqCdRoENr3ECiritRB3DO_MOjRQvgBh5jxZ3Hs1r0,28189
|
410
|
-
orionis-0.
|
411
|
-
orionis-0.
|
412
|
-
orionis-0.
|
413
|
-
orionis-0.
|
414
|
-
orionis-0.
|
409
|
+
orionis-0.589.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
|
410
|
+
orionis-0.589.0.dist-info/METADATA,sha256=1tRDA0nH_HAgPvPbBNK0ZywbkcihrZRHkLU-pxDRHPE,4801
|
411
|
+
orionis-0.589.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
412
|
+
orionis-0.589.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
|
413
|
+
orionis-0.589.0.dist-info/RECORD,,
|
orionis/test/validators/tags.py
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
from orionis.test.exceptions import OrionisTestValueError
|
2
|
-
|
3
|
-
class __ValidTags:
|
4
|
-
|
5
|
-
def __call__(self, tags):
|
6
|
-
"""
|
7
|
-
Validates that the input is a non-empty list of non-empty strings.
|
8
|
-
|
9
|
-
Parameters
|
10
|
-
----------
|
11
|
-
tags : Any
|
12
|
-
The value to validate as a list of non-empty strings.
|
13
|
-
|
14
|
-
Returns
|
15
|
-
-------
|
16
|
-
list or None
|
17
|
-
The validated and stripped list of tags if valid, otherwise None if input is None.
|
18
|
-
|
19
|
-
Raises
|
20
|
-
------
|
21
|
-
OrionisTestValueError
|
22
|
-
If the input is not a non-empty list of non-empty strings.
|
23
|
-
"""
|
24
|
-
if tags is not None:
|
25
|
-
|
26
|
-
if (not isinstance(tags, list) or not tags or not all(isinstance(tag, str) and tag.strip() for tag in tags)):
|
27
|
-
raise OrionisTestValueError(
|
28
|
-
f"Invalid tags: Expected a non-empty list of non-empty strings, got '{tags}' ({type(tags).__name__})."
|
29
|
-
)
|
30
|
-
|
31
|
-
return [str(tag).strip() for tag in tags]
|
32
|
-
|
33
|
-
return None
|
34
|
-
|
35
|
-
# Exported singleton instance
|
36
|
-
ValidTags = __ValidTags()
|
File without changes
|
File without changes
|
File without changes
|