orionis 0.431.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/console/commands/version.py +2 -2
- orionis/console/core/reactor.py +1 -1
- orionis/foundation/config/roots/paths.py +2 -2
- orionis/metadata/framework.py +38 -65
- orionis/metadata/package.py +280 -54
- 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.431.0.dist-info → orionis-0.434.0.dist-info}/METADATA +1 -1
- {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/RECORD +82 -81
- tests/metadata/test_metadata_framework.py +64 -90
- tests/metadata/test_metadata_package.py +31 -31
- 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.431.0.dist-info → orionis-0.434.0.dist-info}/WHEEL +0 -0
- {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/top_level.txt +0 -0
- {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/zip-safe +0 -0
|
@@ -5,8 +5,7 @@ class __ValidExecutionMode:
|
|
|
5
5
|
|
|
6
6
|
def __call__(self, execution_mode: str | ExecutionMode) -> str:
|
|
7
7
|
"""
|
|
8
|
-
|
|
9
|
-
of an ExecutionMode enum member or an instance of the ExecutionMode enum.
|
|
8
|
+
Validate and normalize an execution mode value.
|
|
10
9
|
|
|
11
10
|
Parameters
|
|
12
11
|
----------
|
|
@@ -22,7 +21,7 @@ class __ValidExecutionMode:
|
|
|
22
21
|
Raises
|
|
23
22
|
------
|
|
24
23
|
OrionisTestValueError
|
|
25
|
-
If execution_mode is not a string or ExecutionMode enum, or if the string
|
|
24
|
+
If `execution_mode` is not a string or ExecutionMode enum, or if the string
|
|
26
25
|
does not correspond to a valid ExecutionMode member.
|
|
27
26
|
"""
|
|
28
27
|
|
|
@@ -4,21 +4,17 @@ class __ValidFailFast:
|
|
|
4
4
|
|
|
5
5
|
def __call__(self, fail_fast) -> bool:
|
|
6
6
|
"""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
This class is intended to be used as a callable validator to check that the
|
|
10
|
-
provided `fail_fast` argument is of type `bool`. If the value is not a boolean,
|
|
11
|
-
an `OrionisTestValueError` is raised with a descriptive error message.
|
|
7
|
+
Validates that the `fail_fast` parameter is a boolean.
|
|
12
8
|
|
|
13
9
|
Parameters
|
|
14
10
|
----------
|
|
15
11
|
fail_fast : Any
|
|
16
|
-
The value to
|
|
12
|
+
The value to validate as a boolean.
|
|
17
13
|
|
|
18
14
|
Returns
|
|
19
15
|
-------
|
|
20
16
|
bool
|
|
21
|
-
The validated boolean value
|
|
17
|
+
The validated boolean value.
|
|
22
18
|
|
|
23
19
|
Raises
|
|
24
20
|
------
|
|
@@ -34,4 +30,4 @@ class __ValidFailFast:
|
|
|
34
30
|
return fail_fast
|
|
35
31
|
|
|
36
32
|
# Exported singleton instance
|
|
37
|
-
ValidFailFast = __ValidFailFast()
|
|
33
|
+
ValidFailFast = __ValidFailFast()
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
1
|
from orionis.test.exceptions import OrionisTestValueError
|
|
3
2
|
|
|
4
3
|
class __ValidFolderPath:
|
|
5
4
|
|
|
6
5
|
def __call__(self, folder_path: str) -> str:
|
|
7
6
|
"""
|
|
8
|
-
|
|
7
|
+
Validates that the input is a non-empty string representing a folder path.
|
|
9
8
|
|
|
10
9
|
Parameters
|
|
11
10
|
----------
|
|
12
11
|
folder_path : str
|
|
13
|
-
The folder path to
|
|
12
|
+
The folder path to be validated.
|
|
14
13
|
|
|
15
14
|
Returns
|
|
16
15
|
-------
|
|
17
16
|
str
|
|
18
|
-
The
|
|
17
|
+
The validated and stripped folder path.
|
|
19
18
|
|
|
20
19
|
Raises
|
|
21
20
|
------
|
|
22
21
|
OrionisTestValueError
|
|
23
|
-
If
|
|
22
|
+
If `folder_path` is not a non-empty string.
|
|
24
23
|
"""
|
|
25
|
-
|
|
26
24
|
if not isinstance(folder_path, str) or not folder_path.strip():
|
|
27
25
|
raise OrionisTestValueError(
|
|
28
26
|
f"Invalid folder_path: Expected a non-empty string, got '{str(folder_path)}' ({type(folder_path).__name__})."
|
|
@@ -31,4 +29,4 @@ class __ValidFolderPath:
|
|
|
31
29
|
return folder_path.strip()
|
|
32
30
|
|
|
33
31
|
# Exported singleton instance
|
|
34
|
-
ValidFolderPath = __ValidFolderPath()
|
|
32
|
+
ValidFolderPath = __ValidFolderPath()
|
|
@@ -4,12 +4,12 @@ class __ValidModuleName:
|
|
|
4
4
|
|
|
5
5
|
def __call__(self, module_name) -> str:
|
|
6
6
|
"""
|
|
7
|
-
|
|
7
|
+
Validates that the input is a non-empty string.
|
|
8
8
|
|
|
9
9
|
Parameters
|
|
10
10
|
----------
|
|
11
11
|
module_name : Any
|
|
12
|
-
The value to
|
|
12
|
+
The value to validate as a non-empty string.
|
|
13
13
|
|
|
14
14
|
Returns
|
|
15
15
|
-------
|
|
@@ -28,4 +28,4 @@ class __ValidModuleName:
|
|
|
28
28
|
return module_name
|
|
29
29
|
|
|
30
30
|
# Exported singleton instance
|
|
31
|
-
ValidModuleName = __ValidModuleName()
|
|
31
|
+
ValidModuleName = __ValidModuleName()
|
|
@@ -4,28 +4,23 @@ class __ValidNamePattern:
|
|
|
4
4
|
|
|
5
5
|
def __call__(self, test_name_pattern) -> str:
|
|
6
6
|
"""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
This class is intended to be used as a callable validator to check that the
|
|
10
|
-
provided `test_name_pattern` argument is a non-empty string. If the value is not a valid
|
|
11
|
-
string, an `OrionisTestValueError` is raised with a descriptive error message.
|
|
7
|
+
Validates that the input is a non-empty string.
|
|
12
8
|
|
|
13
9
|
Parameters
|
|
14
10
|
----------
|
|
15
11
|
test_name_pattern : Any
|
|
16
|
-
The value to
|
|
12
|
+
The value to validate as a non-empty string.
|
|
17
13
|
|
|
18
14
|
Returns
|
|
19
15
|
-------
|
|
20
16
|
str
|
|
21
|
-
The validated and stripped string value
|
|
17
|
+
The validated and stripped string if valid, otherwise returns the original value if None.
|
|
22
18
|
|
|
23
19
|
Raises
|
|
24
20
|
------
|
|
25
21
|
OrionisTestValueError
|
|
26
22
|
If `test_name_pattern` is not a non-empty string.
|
|
27
23
|
"""
|
|
28
|
-
|
|
29
24
|
if test_name_pattern is not None:
|
|
30
25
|
|
|
31
26
|
if not isinstance(test_name_pattern, str) or not test_name_pattern.strip():
|
|
@@ -37,4 +32,4 @@ class __ValidNamePattern:
|
|
|
37
32
|
return test_name_pattern
|
|
38
33
|
|
|
39
34
|
# Exported singleton instance
|
|
40
|
-
ValidNamePattern = __ValidNamePattern()
|
|
35
|
+
ValidNamePattern = __ValidNamePattern()
|
|
@@ -4,28 +4,23 @@ class __ValidPattern:
|
|
|
4
4
|
|
|
5
5
|
def __call__(self, pattern) -> str:
|
|
6
6
|
"""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
This class is intended to be used as a callable validator to check that the
|
|
10
|
-
provided `pattern` argument is a non-empty string. If the value is not a valid
|
|
11
|
-
string, an `OrionisTestValueError` is raised with a descriptive error message.
|
|
7
|
+
Validates that the input is a non-empty string.
|
|
12
8
|
|
|
13
9
|
Parameters
|
|
14
10
|
----------
|
|
15
11
|
pattern : Any
|
|
16
|
-
The value to
|
|
12
|
+
The value to validate as a non-empty string.
|
|
17
13
|
|
|
18
14
|
Returns
|
|
19
15
|
-------
|
|
20
16
|
str
|
|
21
|
-
The validated and stripped string
|
|
17
|
+
The validated and stripped string.
|
|
22
18
|
|
|
23
19
|
Raises
|
|
24
20
|
------
|
|
25
21
|
OrionisTestValueError
|
|
26
22
|
If `pattern` is not a non-empty string.
|
|
27
23
|
"""
|
|
28
|
-
|
|
29
24
|
if not isinstance(pattern, str) or not pattern.strip():
|
|
30
25
|
raise OrionisTestValueError(
|
|
31
26
|
f"Invalid pattern: Expected a non-empty string, got '{str(pattern)}' ({type(pattern).__name__})."
|
|
@@ -33,4 +28,4 @@ class __ValidPattern:
|
|
|
33
28
|
return pattern.strip()
|
|
34
29
|
|
|
35
30
|
# Exported singleton instance
|
|
36
|
-
ValidPattern = __ValidPattern()
|
|
31
|
+
ValidPattern = __ValidPattern()
|
|
@@ -4,33 +4,23 @@ class __ValidPersistent:
|
|
|
4
4
|
|
|
5
5
|
def __call__(self, persistent) -> bool:
|
|
6
6
|
"""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
This class is intended to be used as a callable validator to check if the
|
|
10
|
-
provided value for `persistent` is of type `bool`. If the value is not a
|
|
11
|
-
boolean, an `OrionisTestValueError` is raised.
|
|
12
|
-
|
|
13
|
-
Methods
|
|
14
|
-
-------
|
|
15
|
-
__call__(persistent) -> bool
|
|
16
|
-
Validates that `persistent` is a boolean.
|
|
7
|
+
Validates that the input is a boolean value.
|
|
17
8
|
|
|
18
9
|
Parameters
|
|
19
10
|
----------
|
|
20
11
|
persistent : Any
|
|
21
|
-
The value to
|
|
12
|
+
The value to validate as a boolean.
|
|
22
13
|
|
|
23
14
|
Returns
|
|
24
15
|
-------
|
|
25
16
|
bool
|
|
26
|
-
|
|
17
|
+
The input value if it is a boolean.
|
|
27
18
|
|
|
28
19
|
Raises
|
|
29
20
|
------
|
|
30
21
|
OrionisTestValueError
|
|
31
|
-
If
|
|
22
|
+
If the input is not a boolean.
|
|
32
23
|
"""
|
|
33
|
-
|
|
34
24
|
if not isinstance(persistent, bool):
|
|
35
25
|
raise OrionisTestValueError(
|
|
36
26
|
f"Invalid persistent: Expected a boolean, got '{persistent}' ({type(persistent).__name__})."
|
|
@@ -5,28 +5,23 @@ class __ValidPersistentDriver:
|
|
|
5
5
|
|
|
6
6
|
def __call__(self, persistent_driver) -> str:
|
|
7
7
|
"""
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
that it is a string or PersistentDrivers enum and one of the accepted values.
|
|
11
|
-
Methods
|
|
12
|
-
-------
|
|
13
|
-
__call__(persistent_driver: str | PersistentDrivers) -> str
|
|
14
|
-
Validates the given persistent driver. Raises an OrionisTestValueError if
|
|
15
|
-
the input is not a string or enum or not one of the accepted values.
|
|
8
|
+
Validates the provided persistent driver value.
|
|
9
|
+
|
|
16
10
|
Parameters
|
|
17
11
|
----------
|
|
18
|
-
persistent_driver : str
|
|
19
|
-
The persistent driver to validate. Must be either
|
|
12
|
+
persistent_driver : str or PersistentDrivers
|
|
13
|
+
The persistent driver to validate. Must be either a string or a member of the PersistentDrivers enum.
|
|
14
|
+
|
|
20
15
|
Returns
|
|
21
16
|
-------
|
|
22
17
|
str
|
|
23
18
|
The validated persistent driver as a string.
|
|
19
|
+
|
|
24
20
|
Raises
|
|
25
21
|
------
|
|
26
22
|
OrionisTestValueError
|
|
27
|
-
If the input is not a string
|
|
23
|
+
If the input is not a string or PersistentDrivers enum, or if it is not one of the accepted values.
|
|
28
24
|
"""
|
|
29
|
-
|
|
30
25
|
if not isinstance(persistent_driver, (str, PersistentDrivers)):
|
|
31
26
|
raise OrionisTestValueError(
|
|
32
27
|
f"Invalid type for persistent_driver: Expected str or PersistentDrivers, got {type(persistent_driver).__name__}."
|
|
@@ -4,28 +4,23 @@ class __ValidPrintResult:
|
|
|
4
4
|
|
|
5
5
|
def __call__(self, print_result) -> bool:
|
|
6
6
|
"""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
This class is intended to be used as a callable validator to check that the
|
|
10
|
-
provided `print_result` argument is of type `bool`. If the validation fails,
|
|
11
|
-
an `OrionisTestValueError` is raised.
|
|
7
|
+
Validates that the `print_result` parameter is a boolean.
|
|
12
8
|
|
|
13
9
|
Parameters
|
|
14
10
|
----------
|
|
15
11
|
print_result : Any
|
|
16
|
-
The value to
|
|
12
|
+
The value to validate as a boolean.
|
|
17
13
|
|
|
18
14
|
Returns
|
|
19
15
|
-------
|
|
20
16
|
bool
|
|
21
|
-
|
|
17
|
+
The validated boolean value of `print_result`.
|
|
22
18
|
|
|
23
19
|
Raises
|
|
24
20
|
------
|
|
25
21
|
OrionisTestValueError
|
|
26
22
|
If `print_result` is not of type `bool`.
|
|
27
23
|
"""
|
|
28
|
-
|
|
29
24
|
if not isinstance(print_result, bool):
|
|
30
25
|
raise OrionisTestValueError(
|
|
31
26
|
f"Invalid print_result: Expected a boolean, got '{print_result}' ({type(print_result).__name__})."
|
|
@@ -34,4 +29,4 @@ class __ValidPrintResult:
|
|
|
34
29
|
return print_result
|
|
35
30
|
|
|
36
31
|
# Exported singleton instance
|
|
37
|
-
ValidPrintResult = __ValidPrintResult()
|
|
32
|
+
ValidPrintResult = __ValidPrintResult()
|
orionis/test/validators/tags.py
CHANGED
|
@@ -4,24 +4,23 @@ class __ValidTags:
|
|
|
4
4
|
|
|
5
5
|
def __call__(self, tags):
|
|
6
6
|
"""
|
|
7
|
-
|
|
7
|
+
Validates that the input is a non-empty list of non-empty strings.
|
|
8
8
|
|
|
9
9
|
Parameters
|
|
10
10
|
----------
|
|
11
11
|
tags : Any
|
|
12
|
-
The value to
|
|
12
|
+
The value to validate as a list of non-empty strings.
|
|
13
13
|
|
|
14
14
|
Returns
|
|
15
15
|
-------
|
|
16
|
-
list
|
|
17
|
-
The validated and stripped list of tags.
|
|
16
|
+
list or None
|
|
17
|
+
The validated and stripped list of tags if valid, otherwise None if input is None.
|
|
18
18
|
|
|
19
19
|
Raises
|
|
20
20
|
------
|
|
21
21
|
OrionisTestValueError
|
|
22
|
-
If
|
|
22
|
+
If the input is not a non-empty list of non-empty strings.
|
|
23
23
|
"""
|
|
24
|
-
|
|
25
24
|
if tags is not None:
|
|
26
25
|
|
|
27
26
|
if (not isinstance(tags, list) or not tags or not all(isinstance(tag, str) and tag.strip() for tag in tags)):
|
|
@@ -34,4 +33,4 @@ class __ValidTags:
|
|
|
34
33
|
return None
|
|
35
34
|
|
|
36
35
|
# Exported singleton instance
|
|
37
|
-
ValidTags = __ValidTags()
|
|
36
|
+
ValidTags = __ValidTags()
|
|
@@ -4,30 +4,23 @@ class __ValidThrowException:
|
|
|
4
4
|
|
|
5
5
|
def __call__(self, throw_exception) -> bool:
|
|
6
6
|
"""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Methods
|
|
10
|
-
-------
|
|
11
|
-
__call__(throw_exception) -> bool
|
|
12
|
-
Validates that the input `throw_exception` is of type `bool`. If not, raises an OrionisTestValueError
|
|
13
|
-
with a descriptive message. Returns the validated boolean value.
|
|
7
|
+
Validates that the input is a boolean.
|
|
14
8
|
|
|
15
9
|
Parameters
|
|
16
10
|
----------
|
|
17
11
|
throw_exception : Any
|
|
18
|
-
The value to
|
|
12
|
+
The value to validate as a boolean.
|
|
13
|
+
|
|
14
|
+
Returns
|
|
15
|
+
-------
|
|
16
|
+
bool
|
|
17
|
+
The validated boolean value.
|
|
19
18
|
|
|
20
19
|
Raises
|
|
21
20
|
------
|
|
22
21
|
OrionisTestValueError
|
|
23
22
|
If `throw_exception` is not a boolean.
|
|
24
|
-
|
|
25
|
-
Returns
|
|
26
|
-
-------
|
|
27
|
-
bool
|
|
28
|
-
The validated boolean value of `throw_exception`.
|
|
29
23
|
"""
|
|
30
|
-
|
|
31
24
|
if not isinstance(throw_exception, bool):
|
|
32
25
|
raise OrionisTestValueError(
|
|
33
26
|
f"Invalid throw_exception: Expected a boolean, got '{throw_exception}' ({type(throw_exception).__name__})."
|
|
@@ -3,22 +3,32 @@ from orionis.test.exceptions import OrionisTestValueError
|
|
|
3
3
|
|
|
4
4
|
class __ValidVerbosity:
|
|
5
5
|
"""
|
|
6
|
-
Validator
|
|
6
|
+
Validator for verbosity levels, ensuring the input is a non-negative integer corresponding to a valid
|
|
7
|
+
VerbosityMode value or an instance of VerbosityMode.
|
|
8
|
+
|
|
9
|
+
This class is intended to validate verbosity arguments for test configuration.
|
|
7
10
|
"""
|
|
8
11
|
|
|
9
12
|
def __call__(self, verbosity) -> int:
|
|
10
13
|
"""
|
|
11
|
-
|
|
14
|
+
Validate the verbosity level.
|
|
12
15
|
|
|
13
16
|
Parameters
|
|
14
17
|
----------
|
|
15
18
|
verbosity : int or VerbosityMode
|
|
16
|
-
The verbosity level to validate.
|
|
19
|
+
The verbosity level to validate. Must be a non-negative integer matching a VerbosityMode value,
|
|
20
|
+
or an instance of VerbosityMode.
|
|
21
|
+
|
|
22
|
+
Returns
|
|
23
|
+
-------
|
|
24
|
+
int
|
|
25
|
+
The validated verbosity level as an integer.
|
|
17
26
|
|
|
18
27
|
Raises
|
|
19
28
|
------
|
|
20
29
|
OrionisTestValueError
|
|
21
|
-
If the verbosity is not a non-negative integer
|
|
30
|
+
If the verbosity is not a non-negative integer corresponding to a VerbosityMode value,
|
|
31
|
+
nor an instance of VerbosityMode.
|
|
22
32
|
"""
|
|
23
33
|
if isinstance(verbosity, VerbosityMode):
|
|
24
34
|
return verbosity.value
|
|
@@ -34,4 +44,4 @@ class __ValidVerbosity:
|
|
|
34
44
|
)
|
|
35
45
|
|
|
36
46
|
# Exported singleton instance
|
|
37
|
-
ValidVerbosity = __ValidVerbosity()
|
|
47
|
+
ValidVerbosity = __ValidVerbosity()
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
from orionis.test.exceptions import OrionisTestValueError
|
|
2
2
|
|
|
3
3
|
class __ValidWebReport:
|
|
4
|
-
|
|
5
4
|
def __call__(self, web_report) -> bool:
|
|
6
5
|
"""
|
|
7
|
-
|
|
8
|
-
This class is intended to be used as a callable to validate whether the provided
|
|
9
|
-
`web_report` argument is of type `bool`. If the input is not a boolean, an
|
|
10
|
-
`OrionisTestValueError` is raised with a descriptive error message.
|
|
6
|
+
Validates that the input is a boolean value.
|
|
11
7
|
|
|
12
8
|
Parameters
|
|
13
9
|
----------
|
|
14
|
-
|
|
10
|
+
web_report : Any
|
|
11
|
+
The value to be validated as a boolean.
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
Returns
|
|
17
14
|
-------
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
bool
|
|
16
|
+
The validated boolean value.
|
|
20
17
|
|
|
21
18
|
Raises
|
|
22
19
|
------
|
|
23
20
|
OrionisTestValueError
|
|
24
21
|
If `web_report` is not of type `bool`.
|
|
25
22
|
"""
|
|
26
|
-
|
|
27
23
|
if not isinstance(web_report, bool):
|
|
28
24
|
raise OrionisTestValueError(
|
|
29
25
|
f"Invalid web_report: Expected a boolean, got '{web_report}' ({type(web_report).__name__})."
|
|
@@ -3,22 +3,27 @@ from orionis.test.exceptions import OrionisTestValueError
|
|
|
3
3
|
|
|
4
4
|
class __ValidWorkers:
|
|
5
5
|
"""
|
|
6
|
-
Validator
|
|
6
|
+
Validator for the `max_workers` parameter, ensuring it is a positive integer within the allowed range.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
def __call__(self, max_workers: int) -> int:
|
|
10
10
|
"""
|
|
11
|
-
|
|
11
|
+
Validate the `max_workers` argument.
|
|
12
12
|
|
|
13
13
|
Parameters
|
|
14
14
|
----------
|
|
15
15
|
max_workers : int
|
|
16
|
-
The
|
|
16
|
+
The number of worker processes or threads to validate.
|
|
17
|
+
|
|
18
|
+
Returns
|
|
19
|
+
-------
|
|
20
|
+
int
|
|
21
|
+
The validated `max_workers` value.
|
|
17
22
|
|
|
18
23
|
Raises
|
|
19
24
|
------
|
|
20
25
|
OrionisTestValueError
|
|
21
|
-
If max_workers is not a positive integer within allowed range.
|
|
26
|
+
If `max_workers` is not a positive integer within the allowed range.
|
|
22
27
|
"""
|
|
23
28
|
max_allowed = Workers.calculate()
|
|
24
29
|
if not isinstance(max_workers, int) or max_workers < 1 or max_workers > max_allowed:
|
orionis/test/view/render.py
CHANGED
|
@@ -13,28 +13,20 @@ class TestingResultRender(ITestingResultRender):
|
|
|
13
13
|
persist: bool = False
|
|
14
14
|
) -> None:
|
|
15
15
|
"""
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
This constructor sets up the renderer with the provided test result data,
|
|
19
|
-
determines the storage location for the generated report, and configures
|
|
20
|
-
whether persistent storage (e.g., SQLite) should be used for storing and
|
|
21
|
-
retrieving test reports.
|
|
16
|
+
Initializes the TestingResultRender instance.
|
|
22
17
|
|
|
23
18
|
Parameters
|
|
24
19
|
----------
|
|
25
20
|
result : Any
|
|
26
|
-
The test result data to be rendered
|
|
21
|
+
The test result data to be rendered in the report.
|
|
27
22
|
storage_path : str
|
|
28
|
-
|
|
29
|
-
does not exist, it will be created automatically.
|
|
23
|
+
Directory path where the HTML report will be saved. The directory is created if it does not exist.
|
|
30
24
|
persist : bool, optional
|
|
31
25
|
If True, enables persistent storage for test reports (default is False).
|
|
32
26
|
|
|
33
27
|
Returns
|
|
34
28
|
-------
|
|
35
29
|
None
|
|
36
|
-
This constructor does not return a value. It initializes internal state
|
|
37
|
-
and prepares the report path for future rendering.
|
|
38
30
|
"""
|
|
39
31
|
self.__filename = 'orionis-test-results.html'
|
|
40
32
|
self.__result = result
|
|
@@ -52,27 +44,18 @@ class TestingResultRender(ITestingResultRender):
|
|
|
52
44
|
self
|
|
53
45
|
) -> str:
|
|
54
46
|
"""
|
|
55
|
-
|
|
56
|
-
template file with the test results and the persistence mode, then writes the rendered content
|
|
57
|
-
to a report file.
|
|
47
|
+
Renders the test results into an HTML report file.
|
|
58
48
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
If persistence is enabled, retrieves the last 10 reports from the database and includes them in the report.
|
|
50
|
+
Otherwise, only the current in-memory test result is used. The method reads a template file, replaces
|
|
51
|
+
placeholders with the test results and persistence mode, writes the rendered content to a report file,
|
|
52
|
+
and attempts to open the report in the default web browser on supported platforms.
|
|
62
53
|
|
|
63
54
|
Returns
|
|
64
55
|
-------
|
|
65
56
|
str
|
|
66
|
-
The
|
|
67
|
-
|
|
68
|
-
Notes
|
|
69
|
-
-----
|
|
70
|
-
- If persistence is enabled, the last 10 reports are fetched from the SQLite database.
|
|
71
|
-
- If persistence is not enabled, only the current test result in memory is used.
|
|
72
|
-
- The method reads a template file, replaces placeholders with the test results and persistence mode,
|
|
73
|
-
and writes the final content to the report file.
|
|
57
|
+
The absolute path to the generated HTML report file.
|
|
74
58
|
"""
|
|
75
|
-
|
|
76
59
|
# Determine the source of test results based on persistence mode
|
|
77
60
|
if self.__persist:
|
|
78
61
|
|