orionis 0.432.0__py3-none-any.whl → 0.434.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/app.py +17 -0
- orionis/metadata/framework.py +1 -1
- orionis/support/entities/base.py +18 -37
- orionis/support/facades/console.py +3 -9
- orionis/support/facades/dumper.py +3 -9
- orionis/support/facades/logger.py +3 -9
- orionis/support/facades/path_resolver.py +3 -10
- orionis/support/facades/progress_bar.py +3 -10
- orionis/support/facades/testing.py +4 -10
- orionis/support/facades/workers.py +4 -9
- orionis/support/formatter/exceptions/contracts/parser.py +10 -7
- orionis/support/formatter/exceptions/parser.py +28 -26
- orionis/support/formatter/serializer.py +12 -5
- orionis/support/patterns/singleton/meta.py +17 -21
- orionis/support/standard/contracts/std.py +25 -24
- orionis/support/standard/exceptions/value.py +2 -2
- orionis/support/standard/std.py +26 -24
- orionis/support/wrapper/dot_dict.py +16 -51
- orionis/test/cases/asynchronous.py +17 -81
- orionis/test/cases/synchronous.py +17 -73
- orionis/test/contracts/dumper.py +17 -21
- orionis/test/contracts/kernel.py +5 -12
- orionis/test/contracts/logs.py +16 -21
- orionis/test/contracts/printer.py +70 -8
- orionis/test/contracts/render.py +7 -13
- orionis/test/contracts/test_result.py +58 -27
- orionis/test/contracts/unit_test.py +18 -18
- orionis/test/core/unit_test.py +162 -519
- orionis/test/entities/result.py +49 -21
- orionis/test/enums/status.py +11 -17
- orionis/test/exceptions/config.py +4 -8
- orionis/test/exceptions/failure.py +2 -18
- orionis/test/exceptions/persistence.py +4 -8
- orionis/test/exceptions/runtime.py +4 -8
- orionis/test/exceptions/value.py +5 -13
- orionis/test/kernel.py +14 -42
- orionis/test/output/dumper.py +21 -43
- orionis/test/output/printer.py +6 -146
- orionis/test/records/logs.py +57 -121
- orionis/test/validators/base_path.py +8 -6
- orionis/test/validators/execution_mode.py +2 -3
- orionis/test/validators/fail_fast.py +4 -8
- orionis/test/validators/folder_path.py +5 -7
- orionis/test/validators/module_name.py +3 -3
- orionis/test/validators/name_pattern.py +4 -9
- orionis/test/validators/pattern.py +4 -9
- orionis/test/validators/persistent.py +4 -14
- orionis/test/validators/persistent_driver.py +7 -12
- orionis/test/validators/print_result.py +4 -9
- orionis/test/validators/tags.py +6 -7
- orionis/test/validators/throw_exception.py +7 -14
- orionis/test/validators/verbosity.py +15 -5
- orionis/test/validators/web_report.py +6 -10
- orionis/test/validators/workers.py +9 -4
- orionis/test/view/render.py +9 -26
- {orionis-0.432.0.dist-info → orionis-0.434.0.dist-info}/METADATA +1 -1
- {orionis-0.432.0.dist-info → orionis-0.434.0.dist-info}/RECORD +76 -75
- tests/support/entities/mock_dataclass.py +16 -10
- tests/support/entities/test_base.py +6 -14
- tests/support/patterns/singleton/test_patterns_singleton.py +7 -8
- tests/support/standard/test_services_std.py +113 -37
- tests/support/wrapper/test_services_wrapper_docdict.py +25 -40
- tests/testing/cases/test_testing_asynchronous.py +14 -14
- tests/testing/cases/test_testing_synchronous.py +12 -14
- tests/testing/entities/test_testing_result.py +12 -51
- tests/testing/enums/test_testing_status.py +8 -13
- tests/testing/output/test_testing_dumper.py +3 -6
- tests/testing/output/test_testing_printer.py +5 -5
- tests/testing/records/test_testing_records.py +16 -26
- tests/testing/test_testing_unit.py +8 -94
- tests/testing/validators/test_testing_validators.py +55 -112
- tests/testing/view/test_render.py +4 -5
- {orionis-0.432.0.dist-info → orionis-0.434.0.dist-info}/WHEEL +0 -0
- {orionis-0.432.0.dist-info → orionis-0.434.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.432.0.dist-info → orionis-0.434.0.dist-info}/top_level.txt +0 -0
- {orionis-0.432.0.dist-info → orionis-0.434.0.dist-info}/zip-safe +0 -0
|
@@ -3,52 +3,28 @@ from orionis.test.output.dumper import TestDumper
|
|
|
3
3
|
|
|
4
4
|
class SyncTestCase(unittest.TestCase, TestDumper):
|
|
5
5
|
"""
|
|
6
|
-
Base
|
|
6
|
+
Base class for synchronous unit tests in the Orionis framework.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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.
|
|
8
|
+
Inherits from `unittest.TestCase` and `TestDumper`, providing
|
|
9
|
+
hooks for custom setup and teardown logic via `onSetup()` and
|
|
10
|
+
`onTeardown()` methods. Subclasses should override these hooks
|
|
11
|
+
to implement test-specific initialization and cleanup.
|
|
15
12
|
|
|
16
13
|
Attributes
|
|
17
14
|
----------
|
|
18
15
|
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
16
|
"""
|
|
31
17
|
|
|
32
18
|
def setUp(self):
|
|
33
19
|
"""
|
|
34
|
-
|
|
20
|
+
Set up the test environment before each test method.
|
|
35
21
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
and then calls the onSetup() hook for custom initialization.
|
|
39
|
-
|
|
40
|
-
Parameters
|
|
41
|
-
----------
|
|
42
|
-
None
|
|
22
|
+
Calls the superclass `setUp()` and then invokes the
|
|
23
|
+
`onSetup()` hook for additional initialization.
|
|
43
24
|
|
|
44
25
|
Returns
|
|
45
26
|
-------
|
|
46
27
|
None
|
|
47
|
-
|
|
48
|
-
Notes
|
|
49
|
-
-----
|
|
50
|
-
This method should not be overridden directly. Use onSetup() instead
|
|
51
|
-
for custom setup logic.
|
|
52
28
|
"""
|
|
53
29
|
super().setUp()
|
|
54
30
|
self.onSetup()
|
|
@@ -57,70 +33,38 @@ class SyncTestCase(unittest.TestCase, TestDumper):
|
|
|
57
33
|
"""
|
|
58
34
|
Clean up the test environment after each test method.
|
|
59
35
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
cleanup and then performs the standard unittest teardown.
|
|
63
|
-
|
|
64
|
-
Parameters
|
|
65
|
-
----------
|
|
66
|
-
None
|
|
36
|
+
Invokes the `onTeardown()` hook for custom cleanup and
|
|
37
|
+
then calls the superclass `tearDown()`.
|
|
67
38
|
|
|
68
39
|
Returns
|
|
69
40
|
-------
|
|
70
41
|
None
|
|
71
|
-
|
|
72
|
-
Notes
|
|
73
|
-
-----
|
|
74
|
-
This method should not be overridden directly. Use onTeardown() instead
|
|
75
|
-
for custom teardown logic.
|
|
76
42
|
"""
|
|
77
43
|
self.onTeardown()
|
|
78
44
|
super().tearDown()
|
|
79
45
|
|
|
80
46
|
def onSetup(self):
|
|
81
47
|
"""
|
|
82
|
-
Hook
|
|
48
|
+
Hook for subclass-specific setup logic.
|
|
83
49
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
before each test method execution.
|
|
87
|
-
|
|
88
|
-
Parameters
|
|
89
|
-
----------
|
|
90
|
-
None
|
|
50
|
+
Intended to be overridden by subclasses to perform
|
|
51
|
+
custom initialization before each test.
|
|
91
52
|
|
|
92
53
|
Returns
|
|
93
54
|
-------
|
|
94
55
|
None
|
|
95
|
-
|
|
96
|
-
Examples
|
|
97
|
-
--------
|
|
98
|
-
>>> def onSetup(self):
|
|
99
|
-
... self.mock_service = MockService()
|
|
100
|
-
... self.test_data = {"key": "value"}
|
|
101
56
|
"""
|
|
102
57
|
pass
|
|
103
58
|
|
|
104
59
|
def onTeardown(self):
|
|
105
60
|
"""
|
|
106
|
-
Hook
|
|
61
|
+
Hook for subclass-specific teardown logic.
|
|
107
62
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
each test method execution.
|
|
111
|
-
|
|
112
|
-
Parameters
|
|
113
|
-
----------
|
|
114
|
-
None
|
|
63
|
+
Intended to be overridden by subclasses to perform
|
|
64
|
+
custom cleanup after each test.
|
|
115
65
|
|
|
116
66
|
Returns
|
|
117
67
|
-------
|
|
118
68
|
None
|
|
119
|
-
|
|
120
|
-
Examples
|
|
121
|
-
--------
|
|
122
|
-
>>> def onTeardown(self):
|
|
123
|
-
... self.mock_service.cleanup()
|
|
124
|
-
... del self.test_data
|
|
125
69
|
"""
|
|
126
|
-
pass
|
|
70
|
+
pass
|
orionis/test/contracts/dumper.py
CHANGED
|
@@ -2,51 +2,47 @@ from abc import ABC, abstractmethod
|
|
|
2
2
|
|
|
3
3
|
class ITestDumper(ABC):
|
|
4
4
|
"""
|
|
5
|
-
|
|
5
|
+
Abstract base class for debugging output utilities.
|
|
6
6
|
|
|
7
|
-
This interface
|
|
8
|
-
capturing the caller's file, method, and line number, and utilizing
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Implementations
|
|
12
|
-
--------------
|
|
13
|
-
Implementations should provide mechanisms to output or log the
|
|
14
|
-
provided arguments for debugging purposes.
|
|
7
|
+
This interface specifies methods for outputting debugging information,
|
|
8
|
+
capturing the caller's file, method, and line number, and utilizing a
|
|
9
|
+
Debug class to display or log the information.
|
|
15
10
|
"""
|
|
16
11
|
|
|
17
12
|
@abstractmethod
|
|
18
13
|
def dd(self, *args) -> None:
|
|
19
14
|
"""
|
|
20
|
-
|
|
15
|
+
Output debugging information using the Debug class.
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
for debugging purposes.
|
|
17
|
+
Captures the caller's file and line number, then uses the Debug class
|
|
18
|
+
to display or log the provided arguments for debugging purposes.
|
|
25
19
|
|
|
26
20
|
Parameters
|
|
27
21
|
----------
|
|
28
22
|
*args : tuple
|
|
29
|
-
Variable length argument list containing the data to be
|
|
23
|
+
Variable length argument list containing the data to be output.
|
|
30
24
|
|
|
31
25
|
Returns
|
|
32
26
|
-------
|
|
33
27
|
None
|
|
34
|
-
This method does not return any value. Its purpose is to output
|
|
35
|
-
or log the debugging information.
|
|
36
28
|
"""
|
|
37
29
|
pass
|
|
38
30
|
|
|
39
31
|
@abstractmethod
|
|
40
32
|
def dump(self, *args) -> None:
|
|
41
33
|
"""
|
|
42
|
-
|
|
34
|
+
Output debugging information using the Debug class.
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
Captures the caller's file, method, and line number, and uses the
|
|
37
|
+
Debug class to output the provided arguments for debugging purposes.
|
|
46
38
|
|
|
47
39
|
Parameters
|
|
48
40
|
----------
|
|
49
41
|
*args : tuple
|
|
50
|
-
Variable length argument list to be
|
|
42
|
+
Variable length argument list containing the data to be output.
|
|
43
|
+
|
|
44
|
+
Returns
|
|
45
|
+
-------
|
|
46
|
+
None
|
|
51
47
|
"""
|
|
52
|
-
pass
|
|
48
|
+
pass
|
orionis/test/contracts/kernel.py
CHANGED
|
@@ -3,27 +3,20 @@ from orionis.test.contracts.unit_test import IUnitTest
|
|
|
3
3
|
|
|
4
4
|
class ITestKernel(ABC):
|
|
5
5
|
"""
|
|
6
|
-
|
|
6
|
+
Interface for test kernel implementations in the Orionis testing framework.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
across different test kernel implementations.
|
|
11
|
-
|
|
12
|
-
The test kernel is responsible for:
|
|
13
|
-
- Managing application context for testing
|
|
14
|
-
- Validating and handling test configuration
|
|
15
|
-
- Orchestrating test discovery and execution
|
|
16
|
-
- Providing a unified interface for test operations
|
|
8
|
+
The test kernel manages the application context, validates and handles test configuration,
|
|
9
|
+
orchestrates test discovery and execution, and provides a unified interface for test operations.
|
|
17
10
|
"""
|
|
18
11
|
|
|
19
12
|
@abstractmethod
|
|
20
13
|
def handle(self) -> IUnitTest:
|
|
21
14
|
"""
|
|
22
|
-
Configure and execute
|
|
15
|
+
Configure and execute unit tests according to the current configuration.
|
|
23
16
|
|
|
24
17
|
Returns
|
|
25
18
|
-------
|
|
26
19
|
IUnitTest
|
|
27
|
-
|
|
20
|
+
An instance representing the configured and executed unit test.
|
|
28
21
|
"""
|
|
29
22
|
pass
|
orionis/test/contracts/logs.py
CHANGED
|
@@ -3,7 +3,7 @@ from typing import Dict, List, Optional, Tuple
|
|
|
3
3
|
|
|
4
4
|
class ITestLogs(ABC):
|
|
5
5
|
"""
|
|
6
|
-
|
|
6
|
+
Abstract interface for persisting and retrieving test logs in a relational database.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
@abstractmethod
|
|
@@ -13,22 +13,16 @@ class ITestLogs(ABC):
|
|
|
13
13
|
|
|
14
14
|
Parameters
|
|
15
15
|
----------
|
|
16
|
-
report :
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- failed (int)
|
|
22
|
-
- errors (int)
|
|
23
|
-
- skipped (int)
|
|
24
|
-
- total_time (float)
|
|
25
|
-
- success_rate (float)
|
|
26
|
-
- timestamp (str)
|
|
16
|
+
report : dict
|
|
17
|
+
Dictionary containing the test report data. Required keys:
|
|
18
|
+
'json' (str), 'total_tests' (int), 'passed' (int), 'failed' (int),
|
|
19
|
+
'errors' (int), 'skipped' (int), 'total_time' (float),
|
|
20
|
+
'success_rate' (float), 'timestamp' (str).
|
|
27
21
|
|
|
28
22
|
Returns
|
|
29
23
|
-------
|
|
30
24
|
bool
|
|
31
|
-
True if the report was stored successfully.
|
|
25
|
+
True if the report was stored successfully, otherwise False.
|
|
32
26
|
|
|
33
27
|
Raises
|
|
34
28
|
------
|
|
@@ -42,12 +36,12 @@ class ITestLogs(ABC):
|
|
|
42
36
|
@abstractmethod
|
|
43
37
|
def reset(self) -> bool:
|
|
44
38
|
"""
|
|
45
|
-
|
|
39
|
+
Remove all test reports from the database.
|
|
46
40
|
|
|
47
41
|
Returns
|
|
48
42
|
-------
|
|
49
43
|
bool
|
|
50
|
-
True if the table was dropped or did not exist.
|
|
44
|
+
True if the reports table was dropped or did not exist.
|
|
51
45
|
|
|
52
46
|
Raises
|
|
53
47
|
------
|
|
@@ -67,15 +61,16 @@ class ITestLogs(ABC):
|
|
|
67
61
|
|
|
68
62
|
Parameters
|
|
69
63
|
----------
|
|
70
|
-
first :
|
|
71
|
-
Number of earliest reports
|
|
72
|
-
last :
|
|
73
|
-
Number of latest reports
|
|
64
|
+
first : int, optional
|
|
65
|
+
Number of earliest reports to retrieve, ordered by ascending ID.
|
|
66
|
+
last : int, optional
|
|
67
|
+
Number of latest reports to retrieve, ordered by descending ID.
|
|
74
68
|
|
|
75
69
|
Returns
|
|
76
70
|
-------
|
|
77
|
-
|
|
78
|
-
Each tuple:
|
|
71
|
+
list of tuple
|
|
72
|
+
Each tuple contains:
|
|
73
|
+
(id, json, total_tests, passed, failed, errors, skipped, total_time, success_rate, timestamp).
|
|
79
74
|
|
|
80
75
|
Raises
|
|
81
76
|
------
|
|
@@ -9,7 +9,14 @@ class ITestPrinter(ABC):
|
|
|
9
9
|
self,
|
|
10
10
|
value: Any
|
|
11
11
|
) -> None:
|
|
12
|
-
"""
|
|
12
|
+
"""
|
|
13
|
+
Print a value to the console using the rich console.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
value : Any
|
|
18
|
+
The value to be printed to the console.
|
|
19
|
+
"""
|
|
13
20
|
pass
|
|
14
21
|
|
|
15
22
|
@abstractmethod
|
|
@@ -20,7 +27,18 @@ class ITestPrinter(ABC):
|
|
|
20
27
|
execution_mode: str,
|
|
21
28
|
max_workers: int
|
|
22
29
|
):
|
|
23
|
-
"""
|
|
30
|
+
"""
|
|
31
|
+
Display a formatted start message for the test execution session.
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
length_tests : int
|
|
36
|
+
The total number of tests to be executed.
|
|
37
|
+
execution_mode : str
|
|
38
|
+
The mode in which the tests will be executed.
|
|
39
|
+
max_workers : int
|
|
40
|
+
The maximum number of worker threads or processes.
|
|
41
|
+
"""
|
|
24
42
|
pass
|
|
25
43
|
|
|
26
44
|
@abstractmethod
|
|
@@ -29,7 +47,14 @@ class ITestPrinter(ABC):
|
|
|
29
47
|
*,
|
|
30
48
|
summary: Dict[str, Any]
|
|
31
49
|
) -> None:
|
|
32
|
-
"""
|
|
50
|
+
"""
|
|
51
|
+
Display a summary message for the test suite execution.
|
|
52
|
+
|
|
53
|
+
Parameters
|
|
54
|
+
----------
|
|
55
|
+
summary : dict of str to Any
|
|
56
|
+
A dictionary containing summary information about the test execution.
|
|
57
|
+
"""
|
|
33
58
|
pass
|
|
34
59
|
|
|
35
60
|
@abstractmethod
|
|
@@ -39,7 +64,16 @@ class ITestPrinter(ABC):
|
|
|
39
64
|
flatten_test_suite: list,
|
|
40
65
|
callable: callable
|
|
41
66
|
):
|
|
42
|
-
"""
|
|
67
|
+
"""
|
|
68
|
+
Execute a test suite panel with optional live console output.
|
|
69
|
+
|
|
70
|
+
Parameters
|
|
71
|
+
----------
|
|
72
|
+
flatten_test_suite : list
|
|
73
|
+
A flattened list representing the test suite to be executed.
|
|
74
|
+
callable : callable
|
|
75
|
+
A callable object to execute each test.
|
|
76
|
+
"""
|
|
43
77
|
pass
|
|
44
78
|
|
|
45
79
|
@abstractmethod
|
|
@@ -47,7 +81,14 @@ class ITestPrinter(ABC):
|
|
|
47
81
|
self,
|
|
48
82
|
path: str
|
|
49
83
|
):
|
|
50
|
-
"""
|
|
84
|
+
"""
|
|
85
|
+
Print an invitation to view the test results, with an underlined path.
|
|
86
|
+
|
|
87
|
+
Parameters
|
|
88
|
+
----------
|
|
89
|
+
path : str
|
|
90
|
+
The file system or web path to the test results report.
|
|
91
|
+
"""
|
|
51
92
|
pass
|
|
52
93
|
|
|
53
94
|
@abstractmethod
|
|
@@ -55,7 +96,14 @@ class ITestPrinter(ABC):
|
|
|
55
96
|
self,
|
|
56
97
|
summary: Dict[str, Any]
|
|
57
98
|
) -> None:
|
|
58
|
-
"""
|
|
99
|
+
"""
|
|
100
|
+
Print a summary table of test results using the Rich library.
|
|
101
|
+
|
|
102
|
+
Parameters
|
|
103
|
+
----------
|
|
104
|
+
summary : dict of str to Any
|
|
105
|
+
A dictionary containing summary statistics of the test results.
|
|
106
|
+
"""
|
|
59
107
|
pass
|
|
60
108
|
|
|
61
109
|
@abstractmethod
|
|
@@ -64,7 +112,14 @@ class ITestPrinter(ABC):
|
|
|
64
112
|
*,
|
|
65
113
|
summary: Dict[str, Any]
|
|
66
114
|
) -> None:
|
|
67
|
-
"""
|
|
115
|
+
"""
|
|
116
|
+
Display the results of the test execution, including a summary table and details.
|
|
117
|
+
|
|
118
|
+
Parameters
|
|
119
|
+
----------
|
|
120
|
+
summary : dict of str to Any
|
|
121
|
+
A dictionary containing the results and summary of the test execution.
|
|
122
|
+
"""
|
|
68
123
|
pass
|
|
69
124
|
|
|
70
125
|
@abstractmethod
|
|
@@ -72,5 +127,12 @@ class ITestPrinter(ABC):
|
|
|
72
127
|
self,
|
|
73
128
|
test_result: TestResult
|
|
74
129
|
) -> None:
|
|
75
|
-
"""
|
|
130
|
+
"""
|
|
131
|
+
Display the result of a single unit test in a formatted manner.
|
|
132
|
+
|
|
133
|
+
Parameters
|
|
134
|
+
----------
|
|
135
|
+
test_result : TestResult
|
|
136
|
+
The result object of a single unit test.
|
|
137
|
+
"""
|
|
76
138
|
pass
|
orionis/test/contracts/render.py
CHANGED
|
@@ -7,24 +7,18 @@ class ITestingResultRender(ABC):
|
|
|
7
7
|
self
|
|
8
8
|
) -> str:
|
|
9
9
|
"""
|
|
10
|
-
|
|
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
|
|
10
|
+
Generates a report file by rendering test results into a template.
|
|
17
11
|
|
|
18
12
|
Returns
|
|
19
13
|
-------
|
|
20
14
|
str
|
|
21
|
-
The
|
|
15
|
+
The absolute path to the generated report file.
|
|
22
16
|
|
|
23
17
|
Notes
|
|
24
18
|
-----
|
|
25
|
-
- If persistence is enabled, the last 10 reports
|
|
26
|
-
- If persistence is
|
|
27
|
-
-
|
|
28
|
-
and writes the
|
|
19
|
+
- If persistence is enabled, retrieves the last 10 reports from the SQLite database.
|
|
20
|
+
- If persistence is disabled, uses only the current test result stored in memory.
|
|
21
|
+
- Reads a template file, replaces placeholders with test results and persistence mode,
|
|
22
|
+
and writes the rendered content to the report file.
|
|
29
23
|
"""
|
|
30
|
-
pass
|
|
24
|
+
pass
|
|
@@ -5,23 +5,24 @@ from orionis.test.entities.result import TestResult
|
|
|
5
5
|
|
|
6
6
|
class IOrionisTestResult(ABC):
|
|
7
7
|
"""
|
|
8
|
-
Interface for
|
|
9
|
-
|
|
10
|
-
execution time, error tracebacks, and reflection-based information.
|
|
8
|
+
Interface for a custom test result collector that extends unittest's TextTestResult,
|
|
9
|
+
providing detailed execution metadata for each test case.
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
error, and skip states.
|
|
11
|
+
This interface defines properties and methods for capturing test outcomes,
|
|
12
|
+
execution times, error tracebacks, and related metadata for each test case.
|
|
15
13
|
"""
|
|
16
14
|
|
|
17
15
|
@property
|
|
18
16
|
@abstractmethod
|
|
19
17
|
def test_results(self) -> List[TestResult]:
|
|
20
18
|
"""
|
|
21
|
-
|
|
19
|
+
List of detailed results for each executed test case.
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
List[TestResult]
|
|
24
|
+
Each element contains metadata such as status, execution time, method name,
|
|
25
|
+
module, file, and optional error information.
|
|
25
26
|
"""
|
|
26
27
|
pass
|
|
27
28
|
|
|
@@ -29,8 +30,12 @@ class IOrionisTestResult(ABC):
|
|
|
29
30
|
@abstractmethod
|
|
30
31
|
def _test_timings(self) -> Dict[unittest.case.TestCase, float]:
|
|
31
32
|
"""
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
Mapping of test cases to their execution durations in seconds.
|
|
34
|
+
|
|
35
|
+
Returns
|
|
36
|
+
-------
|
|
37
|
+
Dict[unittest.case.TestCase, float]
|
|
38
|
+
Keys are test case instances, values are elapsed times in seconds.
|
|
34
39
|
"""
|
|
35
40
|
pass
|
|
36
41
|
|
|
@@ -38,63 +43,89 @@ class IOrionisTestResult(ABC):
|
|
|
38
43
|
@abstractmethod
|
|
39
44
|
def _current_test_start(self) -> Optional[float]:
|
|
40
45
|
"""
|
|
41
|
-
Timestamp
|
|
42
|
-
|
|
46
|
+
Timestamp marking the start of the currently running test.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
Optional[float]
|
|
51
|
+
Start time in seconds, or None if no test is running.
|
|
43
52
|
"""
|
|
44
53
|
pass
|
|
45
54
|
|
|
46
55
|
@abstractmethod
|
|
47
56
|
def startTest(self, test: unittest.case.TestCase) -> None:
|
|
48
57
|
"""
|
|
49
|
-
|
|
58
|
+
Record the start time for a test case before execution.
|
|
50
59
|
|
|
51
|
-
|
|
60
|
+
Parameters
|
|
61
|
+
----------
|
|
62
|
+
test : unittest.case.TestCase
|
|
63
|
+
The test case about to be executed.
|
|
52
64
|
"""
|
|
53
65
|
pass
|
|
54
66
|
|
|
55
67
|
@abstractmethod
|
|
56
68
|
def stopTest(self, test: unittest.case.TestCase) -> None:
|
|
57
69
|
"""
|
|
58
|
-
|
|
70
|
+
Calculate and store the execution time for a test case after execution.
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
Parameters
|
|
73
|
+
----------
|
|
74
|
+
test : unittest.case.TestCase
|
|
75
|
+
The test case that has finished execution.
|
|
61
76
|
"""
|
|
62
77
|
pass
|
|
63
78
|
|
|
64
79
|
@abstractmethod
|
|
65
80
|
def addSuccess(self, test: unittest.case.TestCase) -> None:
|
|
66
81
|
"""
|
|
67
|
-
|
|
82
|
+
Append a successful test result to the results list.
|
|
68
83
|
|
|
69
|
-
|
|
84
|
+
Parameters
|
|
85
|
+
----------
|
|
86
|
+
test : unittest.case.TestCase
|
|
87
|
+
The test case that completed successfully.
|
|
70
88
|
"""
|
|
71
89
|
pass
|
|
72
90
|
|
|
73
91
|
@abstractmethod
|
|
74
92
|
def addFailure(self, test: unittest.case.TestCase, err: Tuple[BaseException, BaseException, object]) -> None:
|
|
75
93
|
"""
|
|
76
|
-
|
|
94
|
+
Append a failed test result, including traceback and error message.
|
|
77
95
|
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
test : unittest.case.TestCase
|
|
99
|
+
The test case that failed.
|
|
100
|
+
err : tuple
|
|
101
|
+
Tuple containing exception type, exception instance, and traceback object.
|
|
80
102
|
"""
|
|
81
103
|
pass
|
|
82
104
|
|
|
83
105
|
@abstractmethod
|
|
84
106
|
def addError(self, test: unittest.case.TestCase, err: Tuple[BaseException, BaseException, object]) -> None:
|
|
85
107
|
"""
|
|
86
|
-
|
|
108
|
+
Append an errored test result, including traceback and error message.
|
|
87
109
|
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
test : unittest.case.TestCase
|
|
113
|
+
The test case that encountered an error.
|
|
114
|
+
err : tuple
|
|
115
|
+
Tuple containing exception type, exception instance, and traceback object.
|
|
90
116
|
"""
|
|
91
117
|
pass
|
|
92
118
|
|
|
93
119
|
@abstractmethod
|
|
94
120
|
def addSkip(self, test: unittest.case.TestCase, reason: str) -> None:
|
|
95
121
|
"""
|
|
96
|
-
|
|
122
|
+
Append a skipped test result with the provided reason.
|
|
97
123
|
|
|
98
|
-
|
|
124
|
+
Parameters
|
|
125
|
+
----------
|
|
126
|
+
test : unittest.case.TestCase
|
|
127
|
+
The test case that was skipped.
|
|
128
|
+
reason : str
|
|
129
|
+
Reason for skipping the test.
|
|
99
130
|
"""
|
|
100
131
|
pass
|