orionis 0.372.0__py3-none-any.whl → 0.374.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.
Files changed (99) hide show
  1. orionis/__init__.py +4 -2
  2. orionis/container/facades/facade.py +10 -8
  3. orionis/container/resolver/resolver.py +3 -3
  4. orionis/foundation/application.py +25 -0
  5. orionis/metadata/framework.py +1 -1
  6. orionis/services/introspection/dependencies/entities/callable_dependencies.py +6 -6
  7. orionis/services/introspection/dependencies/entities/class_dependencies.py +7 -7
  8. orionis/services/introspection/dependencies/entities/{resolved_dependencies.py → known_dependencies.py} +1 -1
  9. orionis/services/introspection/dependencies/entities/method_dependencies.py +6 -6
  10. orionis/services/introspection/dependencies/reflection.py +4 -4
  11. orionis/test/arguments/parser.py +187 -0
  12. orionis/test/cases/asynchronous.py +145 -0
  13. orionis/test/cases/synchronous.py +135 -0
  14. orionis/test/contracts/kernel.py +134 -0
  15. orionis/test/contracts/logs.py +125 -0
  16. orionis/test/contracts/parser.py +43 -0
  17. orionis/test/contracts/render.py +30 -0
  18. orionis/test/contracts/unit_test.py +21 -0
  19. orionis/test/core/unit_test.py +104 -23
  20. orionis/test/entities/arguments.py +38 -0
  21. orionis/test/kernel.py +336 -0
  22. orionis/test/output/dumper.py +3 -4
  23. orionis/test/output/printer.py +22 -0
  24. orionis/test/{logs → record}/history.py +25 -9
  25. orionis/test/records/__init__.py +0 -0
  26. orionis/test/records/logs.py +385 -0
  27. orionis/test/view/render.py +8 -5
  28. {orionis-0.372.0.dist-info → orionis-0.374.0.dist-info}/METADATA +1 -1
  29. {orionis-0.372.0.dist-info → orionis-0.374.0.dist-info}/RECORD +93 -88
  30. tests/example/test_example.py +4 -3
  31. tests/foundation/config/app/test_foundation_config_app.py +2 -2
  32. tests/foundation/config/auth/test_foundation_config_auth.py +2 -2
  33. tests/foundation/config/cache/test_foundation_config_cache.py +2 -2
  34. tests/foundation/config/cache/test_foundation_config_cache_file.py +2 -2
  35. tests/foundation/config/cache/test_foundation_config_cache_stores.py +2 -2
  36. tests/foundation/config/cors/test_foundation_config_cors.py +2 -2
  37. tests/foundation/config/database/test_foundation_config_database.py +2 -2
  38. tests/foundation/config/database/test_foundation_config_database_connections.py +2 -2
  39. tests/foundation/config/database/test_foundation_config_database_mysql.py +2 -2
  40. tests/foundation/config/database/test_foundation_config_database_oracle.py +2 -2
  41. tests/foundation/config/database/test_foundation_config_database_pgsql.py +2 -2
  42. tests/foundation/config/database/test_foundation_config_database_sqlite.py +2 -2
  43. tests/foundation/config/filesystems/test_foundation_config_filesystems.py +2 -2
  44. tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +2 -2
  45. tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +2 -2
  46. tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +2 -2
  47. tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +2 -2
  48. tests/foundation/config/logging/test_foundation_config_logging.py +2 -2
  49. tests/foundation/config/logging/test_foundation_config_logging_channels.py +2 -2
  50. tests/foundation/config/logging/test_foundation_config_logging_chunked.py +2 -2
  51. tests/foundation/config/logging/test_foundation_config_logging_daily.py +2 -2
  52. tests/foundation/config/logging/test_foundation_config_logging_hourly.py +2 -2
  53. tests/foundation/config/logging/test_foundation_config_logging_monthly.py +2 -2
  54. tests/foundation/config/logging/test_foundation_config_logging_stack.py +2 -2
  55. tests/foundation/config/logging/test_foundation_config_logging_weekly.py +2 -2
  56. tests/foundation/config/mail/test_foundation_config_mail.py +2 -2
  57. tests/foundation/config/mail/test_foundation_config_mail_file.py +2 -2
  58. tests/foundation/config/mail/test_foundation_config_mail_mailers.py +2 -2
  59. tests/foundation/config/mail/test_foundation_config_mail_smtp.py +2 -2
  60. tests/foundation/config/queue/test_foundation_config_queue.py +2 -5
  61. tests/foundation/config/queue/test_foundation_config_queue_brokers.py +2 -2
  62. tests/foundation/config/queue/test_foundation_config_queue_database.py +3 -2
  63. tests/foundation/config/root/test_foundation_config_root_paths.py +3 -3
  64. tests/foundation/config/session/test_foundation_config_session.py +4 -3
  65. tests/foundation/config/startup/test_foundation_config_startup.py +4 -3
  66. tests/foundation/config/testing/test_foundation_config_testing.py +3 -3
  67. tests/foundation/exceptions/test_foundation_config_exceptions.py +3 -3
  68. tests/metadata/test_metadata_framework.py +2 -2
  69. tests/metadata/test_metadata_package.py +3 -2
  70. tests/services/asynchrony/test_services_asynchrony_coroutine.py +2 -2
  71. tests/services/environment/test_services_environment.py +2 -2
  72. tests/services/inspection/dependencies/test_reflect_dependencies.py +22 -22
  73. tests/services/inspection/reflection/test_reflection_abstract.py +2 -2
  74. tests/services/inspection/reflection/test_reflection_callable.py +2 -2
  75. tests/services/inspection/reflection/test_reflection_concrete.py +2 -2
  76. tests/services/inspection/reflection/test_reflection_instance.py +2 -2
  77. tests/services/inspection/reflection/test_reflection_module.py +2 -2
  78. tests/services/inspection/test_reflection.py +2 -2
  79. tests/services/path/test_services_resolver.py +2 -2
  80. tests/services/system/test_services_system_imports.py +2 -2
  81. tests/services/system/test_services_system_workers.py +3 -2
  82. tests/support/parsers/test_services_parser_exceptions.py +2 -2
  83. tests/support/patterns/singleton/test_patterns_singleton.py +2 -2
  84. tests/support/standard/test_services_std.py +2 -2
  85. tests/support/wrapper/test_services_wrapper_docdict.py +2 -2
  86. tests/testing/test_testing_result.py +4 -6
  87. tests/testing/test_testing_unit.py +9 -10
  88. orionis/test/cases/test_async.py +0 -55
  89. orionis/test/cases/test_case.py +0 -42
  90. orionis/test/cases/test_sync.py +0 -33
  91. orionis/test/contracts/history.py +0 -54
  92. orionis/test/test_suite.py +0 -142
  93. orionis/unittesting.py +0 -64
  94. /orionis/test/{logs → arguments}/__init__.py +0 -0
  95. /orionis/test/entities/{test_result.py → result.py} +0 -0
  96. {orionis-0.372.0.dist-info → orionis-0.374.0.dist-info}/WHEEL +0 -0
  97. {orionis-0.372.0.dist-info → orionis-0.374.0.dist-info}/licenses/LICENCE +0 -0
  98. {orionis-0.372.0.dist-info → orionis-0.374.0.dist-info}/top_level.txt +0 -0
  99. {orionis-0.372.0.dist-info → orionis-0.374.0.dist-info}/zip-safe +0 -0
@@ -1,42 +0,0 @@
1
- import unittest
2
- from orionis.test.output.dumper import TestDumper
3
-
4
- class TestCase(unittest.IsolatedAsyncioTestCase, TestDumper):
5
- """
6
- Base test case for async unit tests.
7
- """
8
-
9
- async def asyncSetUp(self):
10
- """
11
- Asynchronous setup method called before each test.
12
-
13
- This method first calls the parent class's asyncSetUp method to ensure any inherited setup logic is executed.
14
- Then, it calls the onAsyncSetup method, which can be used to perform additional asynchronous setup specific to this test case.
15
-
16
- Override this method to customize asynchronous setup behavior for your tests.
17
- """
18
- await super().asyncSetUp()
19
- await self.onAsyncSetup()
20
-
21
- async def asyncTearDown(self):
22
- """
23
- Asynchronous teardown method called after each test.
24
-
25
- This method performs any necessary asynchronous cleanup by first invoking
26
- the custom `onAsyncTeardown` coroutine, followed by the superclass's
27
- `asyncTearDown` method to ensure proper teardown in the test lifecycle.
28
- """
29
- await self.onAsyncTeardown()
30
- await super().asyncTearDown()
31
-
32
- async def onAsyncSetup(self):
33
- """
34
- Hook for subclasses to add async setup logic.
35
- """
36
- pass
37
-
38
- async def onAsyncTeardown(self):
39
- """
40
- Hook for subclasses to add async teardown logic.
41
- """
42
- pass
@@ -1,33 +0,0 @@
1
- import unittest
2
- from orionis.test.output.dumper import TestDumper
3
-
4
- class SyncTestCase(unittest.TestCase, TestDumper):
5
- """
6
- Base test case for sync unit tests.
7
- """
8
-
9
- def setUp(self):
10
- """
11
- Synchronous setup method called before each test.
12
- """
13
- super().setUp()
14
- self.onSetup()
15
-
16
- def tearDown(self):
17
- """
18
- Synchronous teardown method called after each test.
19
- """
20
- self.onTeardown()
21
- super().tearDown()
22
-
23
- def onSetup(self):
24
- """
25
- Hook for subclasses to add setup logic.
26
- """
27
- pass
28
-
29
- def onTeardown(self):
30
- """
31
- Hook for subclasses to add teardown logic.
32
- """
33
- pass
@@ -1,54 +0,0 @@
1
- from abc import ABC, abstractmethod
2
- from typing import Dict, List, Optional, Tuple
3
-
4
- class ITestHistory(ABC):
5
-
6
- @abstractmethod
7
- def create(self, report: Dict) -> bool:
8
- """
9
- Create a new test report in the history database.
10
-
11
- Parameters
12
- ----------
13
- report : Dict
14
- A dictionary containing the test report data.
15
-
16
- Returns
17
- -------
18
- bool
19
- True if the report was successfully created, False otherwise.
20
- """
21
- pass
22
-
23
- def reset(self) -> bool:
24
- """
25
- Reset the history database by dropping the existing table.
26
-
27
- Returns
28
- -------
29
- bool
30
- True if the database was successfully reset, False otherwise.
31
- """
32
- pass
33
-
34
- def get(
35
- self,
36
- first: Optional[int] = None,
37
- last: Optional[int] = None
38
- ) -> List[Tuple]:
39
- """
40
- Retrieve test reports from the history database.
41
-
42
- Parameters
43
- ----------
44
- first : Optional[int], default=None
45
- The number of earliest reports to retrieve, ordered ascending by ID.
46
- last : Optional[int], default=None
47
- The number of latest reports to retrieve, ordered descending by ID.
48
-
49
- Returns
50
- -------
51
- List[Tuple]
52
- A list of tuples representing the retrieved reports.
53
- """
54
- pass
@@ -1,142 +0,0 @@
1
- import re
2
- from os import walk
3
- from orionis.foundation.config.testing.entities.testing import Testing as Configuration
4
- from orionis.test.exceptions import OrionisTestConfigException
5
- from orionis.test.core.unit_test import UnitTest
6
-
7
- class TestSuite:
8
- """
9
- TestSuite manages and executes a suite of unit tests based on a configurable set of parameters.
10
-
11
- Parameters
12
- ----------
13
- config : Configuration, optional
14
- Configuration object specifying parameters for test suite execution. If not provided, a new Configuration instance is created.
15
-
16
- Attributes
17
- ----------
18
- _config : Configuration
19
- The configuration object controlling test suite behavior, such as verbosity, execution mode, worker count, and test discovery patterns.
20
-
21
- Methods
22
- -------
23
- __init__(config=None)
24
- Initializes the TestSuite with the provided configuration or a default one.
25
- run()
26
- Executes the test suite according to the configuration. Discovers test folders matching the specified pattern, adds discovered tests to the suite, and runs them.
27
- getResult()
28
- Returns the results of the executed test suite.
29
- """
30
-
31
- def __init__(self, config:Configuration = None, **kwargs):
32
- """
33
- Initializes the TestSuite with the provided configuration.
34
-
35
- Parameters
36
- ----------
37
- config : Configuration, optional
38
- Configuration object specifying parameters for test suite execution. If not provided, a new Configuration instance is created.
39
- """
40
-
41
- # Check if config is None and kwargs are provided
42
- if config is None:
43
-
44
- try:
45
-
46
- # Attempt to create a Configuration instance with provided keyword arguments
47
- config = Configuration(**kwargs)
48
-
49
- except TypeError:
50
-
51
- # If a TypeError occurs, it indicates that the provided arguments do not match the Configuration class
52
- required_fields = []
53
- for field in Configuration().getFields():
54
- required_fields.append(f"{field.get('name')} = (Type: {field.get('type')}, Default: {field.get('default')})")
55
-
56
- # Raise an exception with a detailed message about the required fields
57
- raise OrionisTestConfigException(f"The provided configuration is not valid. Please ensure it is an instance of the Configuration class or provide valid keyword arguments. \n{str("\n").join(required_fields)}]")
58
-
59
- # Assign the configuration to the instance variable
60
- self.__config = config or Configuration()
61
-
62
- def run(self) -> 'UnitTest':
63
- """
64
- Runs the test suite based on the provided configuration.
65
-
66
- Initializes a UnitTest suite, configures it with parameters from the Configuration object,
67
- discovers test folders matching the specified pattern, adds the discovered tests to the suite,
68
- executes the test suite, and returns the results.
69
-
70
- Returns
71
- -------
72
- UnitTest
73
- The result of the executed test suite.
74
-
75
- Raises
76
- ------
77
- OrionisTestConfigException
78
- If the provided configuration is not an instance of Configuration.
79
- """
80
-
81
- # Check if the config is provided
82
- config = self.__config
83
-
84
- # Check if the config is an instance of Configuration
85
- if not isinstance(config, Configuration):
86
- raise OrionisTestConfigException("The config parameter must be an instance of the Configuration class.")
87
-
88
- # Initialize the test suite
89
- tests = UnitTest()
90
-
91
- # Assign config values to the test suite
92
- tests.configure(
93
- verbosity=config.verbosity,
94
- execution_mode=config.execution_mode,
95
- max_workers=config.max_workers,
96
- fail_fast=config.fail_fast,
97
- print_result=config.print_result,
98
- throw_exception=config.throw_exception,
99
- persistent=config.persistent,
100
- persistent_driver=config.persistent_driver,
101
- web_report=config.web_report
102
- )
103
-
104
- # Extract configuration values
105
- base_path = config.base_path
106
- folder_path = config.folder_path
107
- pattern = config.pattern
108
-
109
- # Helper function to list folders matching the pattern
110
- def list_matching_folders(custom_path: str, pattern: str):
111
- matched_folders = []
112
- for root, _, files in walk(custom_path):
113
- for file in files:
114
- if re.fullmatch(pattern.replace('*', '.*').replace('?', '.'), file):
115
- relative_path = root.replace(base_path, '').replace('\\', '/').lstrip('/')
116
- if relative_path not in matched_folders:
117
- matched_folders.append(relative_path)
118
- return matched_folders
119
-
120
- # Discover folders
121
- discovered_folders = []
122
- if folder_path == '*':
123
- discovered_folders.extend(list_matching_folders(base_path, pattern))
124
- elif isinstance(folder_path, list):
125
- for custom_path in folder_path:
126
- discovered_folders.extend(list_matching_folders(f"{base_path}/{custom_path}", pattern))
127
- else:
128
- discovered_folders.extend(list_matching_folders(folder_path, pattern))
129
-
130
- # Add discovered folders to the test suite
131
- for folder in discovered_folders:
132
- tests.discoverTestsInFolder(
133
- folder_path=folder,
134
- base_path=base_path,
135
- pattern=pattern,
136
- test_name_pattern=config.test_name_pattern if config.test_name_pattern else None,
137
- tags=config.tags if config.tags else None
138
- )
139
-
140
- # Run the test suite and return the UnitTest instance
141
- tests.run()
142
- return tests
orionis/unittesting.py DELETED
@@ -1,64 +0,0 @@
1
- # Import custom test case classes from the orionis.test.cases module
2
- from orionis.test.cases.test_case import TestCase
3
- from orionis.test.cases.test_sync import SyncTestCase
4
- from orionis.test.cases.test_async import AsyncTestCase
5
-
6
- # Import the custom TestHistory class for logging test results
7
- from orionis.test.logs.history import TestHistory
8
-
9
- # Import the custom TestResult entity
10
- from orionis.test.entities.test_result import TestResult
11
-
12
- # Import enums for execution mode and test status
13
- from orionis.test.enums.execution_mode import ExecutionMode
14
- from orionis.test.enums.status import TestStatus
15
-
16
- # Import custom exception for test failures
17
- from orionis.test.exceptions.failure import OrionisTestFailureException
18
- from orionis.test.exceptions.config import OrionisTestConfigException
19
- from orionis.test.exceptions.persistence import OrionisTestPersistenceError
20
- from orionis.test.exceptions.runtime import OrionisTestRuntimeError
21
- from orionis.test.exceptions.value import OrionisTestValueError
22
-
23
- # Import configuration and suite classes for organizing tests
24
- from orionis.test.test_suite import Configuration, TestSuite
25
- from orionis.test.core.unit_test import UnitTest
26
-
27
- # Import standard unittest components for compatibility
28
- from unittest import (
29
- TestLoader,
30
- TestSuite as StandardTestSuite,
31
- TestResult as StandardTestResult
32
- )
33
-
34
- # Import mock classes for creating test doubles
35
- from unittest.mock import (
36
- Mock,
37
- MagicMock,
38
- patch
39
- )
40
-
41
- # Define the public API of this module
42
- __all__ = [
43
- "TestCase",
44
- "SyncTestCase",
45
- "AsyncTestCase",
46
- "TestResult",
47
- "ExecutionMode",
48
- "TestStatus",
49
- "OrionisTestFailureException",
50
- "OrionisTestConfigException",
51
- "OrionisTestPersistenceError",
52
- "OrionisTestRuntimeError",
53
- "OrionisTestValueError",
54
- "Configuration",
55
- "TestSuite",
56
- "UnitTest",
57
- "TestLoader",
58
- "StandardTestSuite",
59
- "StandardTestResult",
60
- "Mock",
61
- "MagicMock",
62
- "TestHistory",
63
- "patch",
64
- ]
File without changes
File without changes