orionis 0.371.0__py3-none-any.whl → 0.373.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/__init__.py +9 -0
- orionis/container/resolver/resolver.py +3 -3
- orionis/foundation/application.py +66 -31
- orionis/foundation/contracts/application.py +1 -1
- orionis/metadata/framework.py +1 -1
- orionis/services/introspection/dependencies/entities/callable_dependencies.py +6 -6
- orionis/services/introspection/dependencies/entities/class_dependencies.py +7 -7
- orionis/services/introspection/dependencies/entities/{resolved_dependencies.py → known_dependencies.py} +1 -1
- orionis/services/introspection/dependencies/entities/method_dependencies.py +6 -6
- orionis/services/introspection/dependencies/reflection.py +4 -4
- orionis/test/arguments/parser.py +197 -0
- orionis/test/cases/asynchronous.py +145 -0
- orionis/test/cases/synchronous.py +135 -0
- orionis/test/contracts/kernel.py +99 -0
- orionis/test/contracts/logs.py +125 -0
- orionis/test/contracts/parser.py +37 -0
- orionis/test/contracts/render.py +30 -0
- orionis/test/contracts/unit_test.py +21 -0
- orionis/test/core/unit_test.py +104 -23
- orionis/test/entities/arguments.py +38 -0
- orionis/test/kernel.py +276 -0
- orionis/test/output/dumper.py +3 -4
- orionis/test/output/printer.py +22 -0
- orionis/test/{logs → record}/history.py +25 -9
- orionis/test/records/__init__.py +0 -0
- orionis/test/records/logs.py +385 -0
- orionis/test/view/render.py +8 -5
- {orionis-0.371.0.dist-info → orionis-0.373.0.dist-info}/METADATA +1 -1
- {orionis-0.371.0.dist-info → orionis-0.373.0.dist-info}/RECORD +93 -88
- tests/example/test_example.py +4 -3
- tests/foundation/config/app/test_foundation_config_app.py +2 -2
- tests/foundation/config/auth/test_foundation_config_auth.py +2 -2
- tests/foundation/config/cache/test_foundation_config_cache.py +2 -2
- tests/foundation/config/cache/test_foundation_config_cache_file.py +2 -2
- tests/foundation/config/cache/test_foundation_config_cache_stores.py +2 -2
- tests/foundation/config/cors/test_foundation_config_cors.py +2 -2
- tests/foundation/config/database/test_foundation_config_database.py +2 -2
- tests/foundation/config/database/test_foundation_config_database_connections.py +2 -2
- tests/foundation/config/database/test_foundation_config_database_mysql.py +2 -2
- tests/foundation/config/database/test_foundation_config_database_oracle.py +2 -2
- tests/foundation/config/database/test_foundation_config_database_pgsql.py +2 -2
- tests/foundation/config/database/test_foundation_config_database_sqlite.py +2 -2
- tests/foundation/config/filesystems/test_foundation_config_filesystems.py +2 -2
- tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +2 -2
- tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +2 -2
- tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +2 -2
- tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +2 -2
- tests/foundation/config/logging/test_foundation_config_logging.py +2 -2
- tests/foundation/config/logging/test_foundation_config_logging_channels.py +2 -2
- tests/foundation/config/logging/test_foundation_config_logging_chunked.py +2 -2
- tests/foundation/config/logging/test_foundation_config_logging_daily.py +2 -2
- tests/foundation/config/logging/test_foundation_config_logging_hourly.py +2 -2
- tests/foundation/config/logging/test_foundation_config_logging_monthly.py +2 -2
- tests/foundation/config/logging/test_foundation_config_logging_stack.py +2 -2
- tests/foundation/config/logging/test_foundation_config_logging_weekly.py +2 -2
- tests/foundation/config/mail/test_foundation_config_mail.py +2 -2
- tests/foundation/config/mail/test_foundation_config_mail_file.py +2 -2
- tests/foundation/config/mail/test_foundation_config_mail_mailers.py +2 -2
- tests/foundation/config/mail/test_foundation_config_mail_smtp.py +2 -2
- tests/foundation/config/queue/test_foundation_config_queue.py +2 -5
- tests/foundation/config/queue/test_foundation_config_queue_brokers.py +2 -2
- tests/foundation/config/queue/test_foundation_config_queue_database.py +3 -2
- tests/foundation/config/root/test_foundation_config_root_paths.py +3 -3
- tests/foundation/config/session/test_foundation_config_session.py +4 -3
- tests/foundation/config/startup/test_foundation_config_startup.py +4 -3
- tests/foundation/config/testing/test_foundation_config_testing.py +3 -3
- tests/foundation/exceptions/test_foundation_config_exceptions.py +3 -3
- tests/metadata/test_metadata_framework.py +2 -2
- tests/metadata/test_metadata_package.py +3 -2
- tests/services/asynchrony/test_services_asynchrony_coroutine.py +2 -2
- tests/services/environment/test_services_environment.py +2 -2
- tests/services/inspection/dependencies/test_reflect_dependencies.py +22 -22
- tests/services/inspection/reflection/test_reflection_abstract.py +2 -2
- tests/services/inspection/reflection/test_reflection_callable.py +2 -2
- tests/services/inspection/reflection/test_reflection_concrete.py +2 -2
- tests/services/inspection/reflection/test_reflection_instance.py +2 -2
- tests/services/inspection/reflection/test_reflection_module.py +2 -2
- tests/services/inspection/test_reflection.py +2 -2
- tests/services/path/test_services_resolver.py +2 -2
- tests/services/system/test_services_system_imports.py +2 -2
- tests/services/system/test_services_system_workers.py +3 -2
- tests/support/parsers/test_services_parser_exceptions.py +2 -2
- tests/support/patterns/singleton/test_patterns_singleton.py +2 -2
- tests/support/standard/test_services_std.py +2 -2
- tests/support/wrapper/test_services_wrapper_docdict.py +2 -2
- tests/testing/test_testing_result.py +4 -6
- tests/testing/test_testing_unit.py +9 -10
- orionis/test/cases/test_async.py +0 -55
- orionis/test/cases/test_case.py +0 -42
- orionis/test/cases/test_sync.py +0 -33
- orionis/test/contracts/history.py +0 -54
- orionis/test/test_suite.py +0 -142
- orionis/unittesting.py +0 -64
- /orionis/test/{logs → arguments}/__init__.py +0 -0
- /orionis/test/entities/{test_result.py → result.py} +0 -0
- {orionis-0.371.0.dist-info → orionis-0.373.0.dist-info}/WHEEL +0 -0
- {orionis-0.371.0.dist-info → orionis-0.373.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.371.0.dist-info → orionis-0.373.0.dist-info}/top_level.txt +0 -0
- {orionis-0.371.0.dist-info → orionis-0.373.0.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from orionis.test.output.dumper import TestDumper
|
|
3
|
+
|
|
4
|
+
class AsyncTestCase(unittest.IsolatedAsyncioTestCase, TestDumper):
|
|
5
|
+
"""
|
|
6
|
+
Base test case class for asynchronous unit testing.
|
|
7
|
+
|
|
8
|
+
This class provides a foundation for writing asynchronous unit tests within
|
|
9
|
+
the Orionis framework. It extends unittest.IsolatedAsyncioTestCase and includes
|
|
10
|
+
TestDumper functionality for enhanced test output and debugging capabilities.
|
|
11
|
+
|
|
12
|
+
The class provides hooks for custom async setup and teardown logic through the
|
|
13
|
+
onAsyncSetup() and onAsyncTeardown() methods, which can be overridden by subclasses
|
|
14
|
+
to implement test-specific asynchronous initialization and cleanup procedures.
|
|
15
|
+
|
|
16
|
+
Each test method runs in its own isolated asyncio event loop, ensuring proper
|
|
17
|
+
isolation and preventing side effects between tests.
|
|
18
|
+
|
|
19
|
+
Attributes
|
|
20
|
+
----------
|
|
21
|
+
None
|
|
22
|
+
|
|
23
|
+
Methods
|
|
24
|
+
-------
|
|
25
|
+
asyncSetUp()
|
|
26
|
+
Initialize test environment before each async test method execution.
|
|
27
|
+
asyncTearDown()
|
|
28
|
+
Clean up test environment after each async test method execution.
|
|
29
|
+
onAsyncSetup()
|
|
30
|
+
Hook method for subclass-specific async setup logic.
|
|
31
|
+
onAsyncTeardown()
|
|
32
|
+
Hook method for subclass-specific async teardown logic.
|
|
33
|
+
|
|
34
|
+
Examples
|
|
35
|
+
--------
|
|
36
|
+
>>> class MyAsyncTest(AsyncTestCase):
|
|
37
|
+
... async def onAsyncSetup(self):
|
|
38
|
+
... self.client = AsyncHttpClient()
|
|
39
|
+
... await self.client.connect()
|
|
40
|
+
...
|
|
41
|
+
... async def testAsyncOperation(self):
|
|
42
|
+
... result = await self.client.get('/api/data')
|
|
43
|
+
... self.assertEqual(result.status, 200)
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
async def asyncSetUp(self):
|
|
47
|
+
"""
|
|
48
|
+
Initialize the test environment before each async test method.
|
|
49
|
+
|
|
50
|
+
This method is automatically called by the unittest framework before
|
|
51
|
+
each async test method execution. It performs the standard unittest
|
|
52
|
+
async setup and then calls the onAsyncSetup() hook for custom
|
|
53
|
+
asynchronous initialization.
|
|
54
|
+
|
|
55
|
+
Parameters
|
|
56
|
+
----------
|
|
57
|
+
None
|
|
58
|
+
|
|
59
|
+
Returns
|
|
60
|
+
-------
|
|
61
|
+
None
|
|
62
|
+
|
|
63
|
+
Notes
|
|
64
|
+
-----
|
|
65
|
+
This method should not be overridden directly. Use onAsyncSetup() instead
|
|
66
|
+
for custom async setup logic. The method runs in the isolated event loop
|
|
67
|
+
created for each test.
|
|
68
|
+
"""
|
|
69
|
+
await super().asyncSetUp()
|
|
70
|
+
await self.onAsyncSetup()
|
|
71
|
+
|
|
72
|
+
async def asyncTearDown(self):
|
|
73
|
+
"""
|
|
74
|
+
Clean up the test environment after each async test method.
|
|
75
|
+
|
|
76
|
+
This method is automatically called by the unittest framework after
|
|
77
|
+
each async test method execution. It calls the onAsyncTeardown() hook
|
|
78
|
+
for custom cleanup and then performs the standard unittest async teardown.
|
|
79
|
+
|
|
80
|
+
Parameters
|
|
81
|
+
----------
|
|
82
|
+
None
|
|
83
|
+
|
|
84
|
+
Returns
|
|
85
|
+
-------
|
|
86
|
+
None
|
|
87
|
+
|
|
88
|
+
Notes
|
|
89
|
+
-----
|
|
90
|
+
This method should not be overridden directly. Use onAsyncTeardown() instead
|
|
91
|
+
for custom async teardown logic. The method runs in the same isolated event
|
|
92
|
+
loop as the test.
|
|
93
|
+
"""
|
|
94
|
+
await self.onAsyncTeardown()
|
|
95
|
+
await super().asyncTearDown()
|
|
96
|
+
|
|
97
|
+
async def onAsyncSetup(self):
|
|
98
|
+
"""
|
|
99
|
+
Hook method for subclass-specific async setup logic.
|
|
100
|
+
|
|
101
|
+
This method is called during the asyncSetUp() phase and is intended to be
|
|
102
|
+
overridden by subclasses that need to perform custom asynchronous
|
|
103
|
+
initialization before each test method execution.
|
|
104
|
+
|
|
105
|
+
Parameters
|
|
106
|
+
----------
|
|
107
|
+
None
|
|
108
|
+
|
|
109
|
+
Returns
|
|
110
|
+
-------
|
|
111
|
+
None
|
|
112
|
+
|
|
113
|
+
Examples
|
|
114
|
+
--------
|
|
115
|
+
>>> async def onAsyncSetup(self):
|
|
116
|
+
... self.db_connection = await create_async_connection()
|
|
117
|
+
... self.mock_service = AsyncMockService()
|
|
118
|
+
... await self.mock_service.initialize()
|
|
119
|
+
"""
|
|
120
|
+
pass
|
|
121
|
+
|
|
122
|
+
async def onAsyncTeardown(self):
|
|
123
|
+
"""
|
|
124
|
+
Hook method for subclass-specific async teardown logic.
|
|
125
|
+
|
|
126
|
+
This method is called during the asyncTearDown() phase and is intended to be
|
|
127
|
+
overridden by subclasses that need to perform custom asynchronous cleanup
|
|
128
|
+
after each test method execution.
|
|
129
|
+
|
|
130
|
+
Parameters
|
|
131
|
+
----------
|
|
132
|
+
None
|
|
133
|
+
|
|
134
|
+
Returns
|
|
135
|
+
-------
|
|
136
|
+
None
|
|
137
|
+
|
|
138
|
+
Examples
|
|
139
|
+
--------
|
|
140
|
+
>>> async def onAsyncTeardown(self):
|
|
141
|
+
... await self.db_connection.close()
|
|
142
|
+
... await self.mock_service.cleanup()
|
|
143
|
+
... del self.test_data
|
|
144
|
+
"""
|
|
145
|
+
pass
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from orionis.test.output.dumper import TestDumper
|
|
3
|
+
|
|
4
|
+
class SyncTestCase(unittest.TestCase, TestDumper):
|
|
5
|
+
"""
|
|
6
|
+
Base test case class for synchronous unit testing.
|
|
7
|
+
|
|
8
|
+
This class provides a foundation for writing synchronous unit tests within
|
|
9
|
+
the Orionis framework. It extends unittest.TestCase and includes TestDumper
|
|
10
|
+
functionality for enhanced test output and debugging capabilities.
|
|
11
|
+
|
|
12
|
+
The class provides hooks for custom setup and teardown logic through the
|
|
13
|
+
onSetup() and onTeardown() methods, which can be overridden by subclasses
|
|
14
|
+
to implement test-specific initialization and cleanup procedures.
|
|
15
|
+
|
|
16
|
+
Attributes
|
|
17
|
+
----------
|
|
18
|
+
None
|
|
19
|
+
|
|
20
|
+
Methods
|
|
21
|
+
-------
|
|
22
|
+
setUp()
|
|
23
|
+
Initialize test environment before each test method execution.
|
|
24
|
+
tearDown()
|
|
25
|
+
Clean up test environment after each test method execution.
|
|
26
|
+
onSetup()
|
|
27
|
+
Hook method for subclass-specific setup logic.
|
|
28
|
+
onTeardown()
|
|
29
|
+
Hook method for subclass-specific teardown logic.
|
|
30
|
+
|
|
31
|
+
Examples
|
|
32
|
+
--------
|
|
33
|
+
>>> class MyTest(SyncTestCase):
|
|
34
|
+
... def onSetup(self):
|
|
35
|
+
... self.data = [1, 2, 3]
|
|
36
|
+
...
|
|
37
|
+
... def testExample(self):
|
|
38
|
+
... self.assertEqual(len(self.data), 3)
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def setUp(self):
|
|
42
|
+
"""
|
|
43
|
+
Initialize the test environment before each test method.
|
|
44
|
+
|
|
45
|
+
This method is automatically called by the unittest framework before
|
|
46
|
+
each test method execution. It performs the standard unittest setup
|
|
47
|
+
and then calls the onSetup() hook for custom initialization.
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
None
|
|
52
|
+
|
|
53
|
+
Returns
|
|
54
|
+
-------
|
|
55
|
+
None
|
|
56
|
+
|
|
57
|
+
Notes
|
|
58
|
+
-----
|
|
59
|
+
This method should not be overridden directly. Use onSetup() instead
|
|
60
|
+
for custom setup logic.
|
|
61
|
+
"""
|
|
62
|
+
super().setUp()
|
|
63
|
+
self.onSetup()
|
|
64
|
+
|
|
65
|
+
def tearDown(self):
|
|
66
|
+
"""
|
|
67
|
+
Clean up the test environment after each test method.
|
|
68
|
+
|
|
69
|
+
This method is automatically called by the unittest framework after
|
|
70
|
+
each test method execution. It calls the onTeardown() hook for custom
|
|
71
|
+
cleanup and then performs the standard unittest teardown.
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
None
|
|
76
|
+
|
|
77
|
+
Returns
|
|
78
|
+
-------
|
|
79
|
+
None
|
|
80
|
+
|
|
81
|
+
Notes
|
|
82
|
+
-----
|
|
83
|
+
This method should not be overridden directly. Use onTeardown() instead
|
|
84
|
+
for custom teardown logic.
|
|
85
|
+
"""
|
|
86
|
+
self.onTeardown()
|
|
87
|
+
super().tearDown()
|
|
88
|
+
|
|
89
|
+
def onSetup(self):
|
|
90
|
+
"""
|
|
91
|
+
Hook method for subclass-specific setup logic.
|
|
92
|
+
|
|
93
|
+
This method is called during the setUp() phase and is intended to be
|
|
94
|
+
overridden by subclasses that need to perform custom initialization
|
|
95
|
+
before each test method execution.
|
|
96
|
+
|
|
97
|
+
Parameters
|
|
98
|
+
----------
|
|
99
|
+
None
|
|
100
|
+
|
|
101
|
+
Returns
|
|
102
|
+
-------
|
|
103
|
+
None
|
|
104
|
+
|
|
105
|
+
Examples
|
|
106
|
+
--------
|
|
107
|
+
>>> def onSetup(self):
|
|
108
|
+
... self.mock_service = MockService()
|
|
109
|
+
... self.test_data = {"key": "value"}
|
|
110
|
+
"""
|
|
111
|
+
pass
|
|
112
|
+
|
|
113
|
+
def onTeardown(self):
|
|
114
|
+
"""
|
|
115
|
+
Hook method for subclass-specific teardown logic.
|
|
116
|
+
|
|
117
|
+
This method is called during the tearDown() phase and is intended to be
|
|
118
|
+
overridden by subclasses that need to perform custom cleanup after
|
|
119
|
+
each test method execution.
|
|
120
|
+
|
|
121
|
+
Parameters
|
|
122
|
+
----------
|
|
123
|
+
None
|
|
124
|
+
|
|
125
|
+
Returns
|
|
126
|
+
-------
|
|
127
|
+
None
|
|
128
|
+
|
|
129
|
+
Examples
|
|
130
|
+
--------
|
|
131
|
+
>>> def onTeardown(self):
|
|
132
|
+
... self.mock_service.cleanup()
|
|
133
|
+
... del self.test_data
|
|
134
|
+
"""
|
|
135
|
+
pass
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Any
|
|
3
|
+
from orionis.foundation.config.testing.entities.testing import Testing as Configuration
|
|
4
|
+
from orionis.test.core.unit_test import UnitTest
|
|
5
|
+
|
|
6
|
+
class ITestKernel(ABC):
|
|
7
|
+
"""
|
|
8
|
+
Abstract interface for test kernel implementations.
|
|
9
|
+
|
|
10
|
+
This contract defines the required methods that any test kernel implementation
|
|
11
|
+
must provide for the Orionis testing framework. It ensures consistent behavior
|
|
12
|
+
across different test kernel implementations.
|
|
13
|
+
|
|
14
|
+
The test kernel is responsible for:
|
|
15
|
+
- Managing application context for testing
|
|
16
|
+
- Validating and handling test configuration
|
|
17
|
+
- Orchestrating test discovery and execution
|
|
18
|
+
- Providing a unified interface for test operations
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def handle(
|
|
23
|
+
self,
|
|
24
|
+
config: Configuration = None,
|
|
25
|
+
**kwargs: Any
|
|
26
|
+
) -> UnitTest:
|
|
27
|
+
"""
|
|
28
|
+
Execute the complete test discovery and execution pipeline.
|
|
29
|
+
|
|
30
|
+
This is the main entry point for running tests. Implementations must:
|
|
31
|
+
1. Validate the provided configuration
|
|
32
|
+
2. Discover test files based on configuration
|
|
33
|
+
3. Configure and execute the test suite
|
|
34
|
+
4. Return the test results
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
config : Configuration, optional
|
|
39
|
+
A pre-configured Testing configuration instance. If None,
|
|
40
|
+
implementations should create one from kwargs.
|
|
41
|
+
**kwargs : Any
|
|
42
|
+
Keyword arguments to create a Configuration instance if config is None.
|
|
43
|
+
Common parameters include:
|
|
44
|
+
- base_path : str, base directory for test discovery
|
|
45
|
+
- folder_path : str or list, specific folders to search
|
|
46
|
+
- pattern : str, file pattern for test discovery
|
|
47
|
+
- verbosity : int, output verbosity level
|
|
48
|
+
- execution_mode : str, test execution mode
|
|
49
|
+
- max_workers : int, maximum number of worker threads
|
|
50
|
+
- fail_fast : bool, stop on first failure
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
UnitTest
|
|
55
|
+
The configured and executed test suite instance containing all results.
|
|
56
|
+
|
|
57
|
+
Raises
|
|
58
|
+
------
|
|
59
|
+
OrionisTestConfigException
|
|
60
|
+
If the configuration validation fails.
|
|
61
|
+
"""
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
@abstractmethod
|
|
65
|
+
def exit(
|
|
66
|
+
self,
|
|
67
|
+
code: int = 0
|
|
68
|
+
) -> None:
|
|
69
|
+
"""
|
|
70
|
+
Terminate the test execution process and free associated resources.
|
|
71
|
+
|
|
72
|
+
This method performs a clean shutdown of the test kernel by explicitly
|
|
73
|
+
triggering garbage collection to release memory resources and then
|
|
74
|
+
terminating the process with the provided exit code. It ensures that any
|
|
75
|
+
remaining file handles, threads, or other resources are properly released.
|
|
76
|
+
|
|
77
|
+
Parameters
|
|
78
|
+
----------
|
|
79
|
+
code : int
|
|
80
|
+
The exit code to return to the operating system. Should be 0 for
|
|
81
|
+
successful execution or a non-zero value to indicate an error.
|
|
82
|
+
|
|
83
|
+
Returns
|
|
84
|
+
-------
|
|
85
|
+
None
|
|
86
|
+
This method does not return as it terminates the process.
|
|
87
|
+
|
|
88
|
+
Raises
|
|
89
|
+
------
|
|
90
|
+
ValueError
|
|
91
|
+
If the provided code is not a valid integer or outside the allowed range.
|
|
92
|
+
|
|
93
|
+
Notes
|
|
94
|
+
-----
|
|
95
|
+
Using os._exit() bypasses normal Python cleanup mechanisms and
|
|
96
|
+
immediately terminates the process. This can be necessary when
|
|
97
|
+
normal sys.exit() would be caught by exception handlers.
|
|
98
|
+
"""
|
|
99
|
+
pass
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Dict, List, Optional, Tuple
|
|
3
|
+
|
|
4
|
+
class ITestLogs(ABC):
|
|
5
|
+
"""
|
|
6
|
+
Abstract base class for test logging and report persistence.
|
|
7
|
+
|
|
8
|
+
This interface defines the contract for managing test reports in a persistent
|
|
9
|
+
storage system. Implementations should provide functionality to create, retrieve,
|
|
10
|
+
and reset test report data while maintaining proper data validation and error
|
|
11
|
+
handling.
|
|
12
|
+
|
|
13
|
+
The interface supports chronological retrieval of reports and provides methods
|
|
14
|
+
for database management operations.
|
|
15
|
+
|
|
16
|
+
Methods
|
|
17
|
+
-------
|
|
18
|
+
create(report)
|
|
19
|
+
Create and store a new test report in the persistence layer.
|
|
20
|
+
reset()
|
|
21
|
+
Reset the storage by clearing all existing test reports.
|
|
22
|
+
get(first, last)
|
|
23
|
+
Retrieve test reports with optional chronological filtering.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
@abstractmethod
|
|
27
|
+
def create(self, report: Dict) -> bool:
|
|
28
|
+
"""
|
|
29
|
+
Create a new test report in the history database.
|
|
30
|
+
|
|
31
|
+
This method persists a test report containing execution results and
|
|
32
|
+
metadata to the underlying storage system. The report should include
|
|
33
|
+
all necessary fields for proper tracking and analysis.
|
|
34
|
+
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
report : Dict
|
|
38
|
+
A dictionary containing the test report data. Must include fields
|
|
39
|
+
such as total_tests, passed, failed, errors, skipped, total_time,
|
|
40
|
+
success_rate, and timestamp.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
bool
|
|
45
|
+
True if the report was successfully created and stored, False otherwise.
|
|
46
|
+
|
|
47
|
+
Raises
|
|
48
|
+
------
|
|
49
|
+
OrionisTestValueError
|
|
50
|
+
If the report structure is invalid or missing required fields.
|
|
51
|
+
OrionisTestPersistenceError
|
|
52
|
+
If there is an error during the storage operation.
|
|
53
|
+
"""
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
@abstractmethod
|
|
57
|
+
def reset(self) -> bool:
|
|
58
|
+
"""
|
|
59
|
+
Reset the history database by dropping the existing table.
|
|
60
|
+
|
|
61
|
+
This method clears all stored test reports and resets the storage
|
|
62
|
+
system to its initial state. Use with caution as this operation
|
|
63
|
+
is irreversible and will result in permanent data loss.
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
bool
|
|
68
|
+
True if the database was successfully reset, False otherwise.
|
|
69
|
+
|
|
70
|
+
Raises
|
|
71
|
+
------
|
|
72
|
+
OrionisTestPersistenceError
|
|
73
|
+
If there is an error during the reset operation.
|
|
74
|
+
|
|
75
|
+
Notes
|
|
76
|
+
-----
|
|
77
|
+
This operation is destructive and cannot be undone. Ensure that
|
|
78
|
+
any important historical data is backed up before calling this method.
|
|
79
|
+
"""
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
@abstractmethod
|
|
83
|
+
def get(
|
|
84
|
+
self,
|
|
85
|
+
first: Optional[int] = None,
|
|
86
|
+
last: Optional[int] = None
|
|
87
|
+
) -> List[Tuple]:
|
|
88
|
+
"""
|
|
89
|
+
Retrieve test reports from the history database.
|
|
90
|
+
|
|
91
|
+
This method allows for chronological retrieval of test reports with
|
|
92
|
+
optional filtering. You can retrieve either the earliest or most recent
|
|
93
|
+
reports, but not both in a single call.
|
|
94
|
+
|
|
95
|
+
Parameters
|
|
96
|
+
----------
|
|
97
|
+
first : Optional[int], default=None
|
|
98
|
+
The number of earliest reports to retrieve, ordered ascending by ID.
|
|
99
|
+
Must be a positive integer if specified.
|
|
100
|
+
last : Optional[int], default=None
|
|
101
|
+
The number of latest reports to retrieve, ordered descending by ID.
|
|
102
|
+
Must be a positive integer if specified.
|
|
103
|
+
|
|
104
|
+
Returns
|
|
105
|
+
-------
|
|
106
|
+
List[Tuple]
|
|
107
|
+
A list of tuples representing the retrieved reports. Each tuple
|
|
108
|
+
contains the report data in the order: (id, json, total_tests,
|
|
109
|
+
passed, failed, errors, skipped, total_time, success_rate, timestamp).
|
|
110
|
+
|
|
111
|
+
Raises
|
|
112
|
+
------
|
|
113
|
+
OrionisTestValueError
|
|
114
|
+
If both 'first' and 'last' are specified, or if either parameter
|
|
115
|
+
is not a positive integer when provided.
|
|
116
|
+
OrionisTestPersistenceError
|
|
117
|
+
If there is an error retrieving reports from the storage system.
|
|
118
|
+
|
|
119
|
+
Notes
|
|
120
|
+
-----
|
|
121
|
+
Only one of 'first' or 'last' parameters can be specified in a single
|
|
122
|
+
call. The returned results are ordered chronologically based on the
|
|
123
|
+
selected parameter.
|
|
124
|
+
"""
|
|
125
|
+
pass
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from orionis.test.entities.arguments import TestArguments
|
|
3
|
+
|
|
4
|
+
class ITestArgumentParser(ABC):
|
|
5
|
+
"""
|
|
6
|
+
A parser class for handling test command-line arguments.
|
|
7
|
+
|
|
8
|
+
This class encapsulates the logic for creating and configuring the argument parser
|
|
9
|
+
for the Orionis test runner, providing a clean interface for parsing test arguments.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def parse(
|
|
14
|
+
self,
|
|
15
|
+
args=None
|
|
16
|
+
) -> TestArguments:
|
|
17
|
+
"""
|
|
18
|
+
Parse command line arguments and return TestArguments object.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
args : list, optional
|
|
23
|
+
List of arguments to parse. If None, uses sys.argv.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
TestArguments
|
|
28
|
+
Parsed test arguments object.
|
|
29
|
+
"""
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
@abstractmethod
|
|
33
|
+
def help(
|
|
34
|
+
self
|
|
35
|
+
) -> None:
|
|
36
|
+
"""Print help message for the test runner."""
|
|
37
|
+
pass
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
|
|
3
|
+
class ITestingResultRender(ABC):
|
|
4
|
+
|
|
5
|
+
@abstractmethod
|
|
6
|
+
def render(
|
|
7
|
+
self
|
|
8
|
+
) -> str:
|
|
9
|
+
"""
|
|
10
|
+
Otherwise, uses the current test result stored in memory. The method replaces placeholders in a
|
|
11
|
+
template file with the test results and the persistence mode, then writes the rendered content
|
|
12
|
+
to a report file.
|
|
13
|
+
|
|
14
|
+
Parameters
|
|
15
|
+
----------
|
|
16
|
+
None
|
|
17
|
+
|
|
18
|
+
Returns
|
|
19
|
+
-------
|
|
20
|
+
str
|
|
21
|
+
The full path to the generated report file.
|
|
22
|
+
|
|
23
|
+
Notes
|
|
24
|
+
-----
|
|
25
|
+
- If persistence is enabled, the last 10 reports are fetched from the SQLite database.
|
|
26
|
+
- If persistence is not enabled, only the current test result in memory is used.
|
|
27
|
+
- The method reads a template file, replaces placeholders with the test results and persistence mode,
|
|
28
|
+
and writes the final content to the report file.
|
|
29
|
+
"""
|
|
30
|
+
pass
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from typing import Any, Dict, List, Optional
|
|
3
|
+
from orionis.foundation.contracts.application import IApplication
|
|
3
4
|
from orionis.services.system.workers import Workers
|
|
4
5
|
from orionis.test.enums.execution_mode import ExecutionMode
|
|
5
6
|
|
|
@@ -48,6 +49,26 @@ class IUnitTest(ABC):
|
|
|
48
49
|
"""
|
|
49
50
|
pass
|
|
50
51
|
|
|
52
|
+
@abstractmethod
|
|
53
|
+
def setApplication(
|
|
54
|
+
self,
|
|
55
|
+
app: 'IApplication'
|
|
56
|
+
):
|
|
57
|
+
"""
|
|
58
|
+
Set the application instance for the UnitTest.
|
|
59
|
+
This method allows the UnitTest to access the application instance, which is necessary for resolving dependencies and executing tests.
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
----------
|
|
63
|
+
app : IApplication
|
|
64
|
+
The application instance to be set for the UnitTest.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
UnitTest
|
|
69
|
+
"""
|
|
70
|
+
pass
|
|
71
|
+
|
|
51
72
|
@abstractmethod
|
|
52
73
|
def discoverTestsInFolder(
|
|
53
74
|
self,
|