orionis 0.285.0__py3-none-any.whl → 0.287.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 (67) hide show
  1. orionis/metadata/framework.py +1 -1
  2. orionis/services/asynchrony/contracts/__init__.py +0 -0
  3. orionis/services/asynchrony/contracts/coroutines.py +24 -0
  4. orionis/services/asynchrony/coroutines.py +58 -19
  5. orionis/services/asynchrony/exceptions/coroutine_exception.py +8 -15
  6. orionis/services/environment/contracts/env.py +45 -50
  7. orionis/services/environment/dot_env.py +205 -181
  8. orionis/services/environment/env.py +68 -85
  9. orionis/services/environment/exceptions/environment_value_error.py +18 -0
  10. orionis/services/environment/exceptions/environment_value_exception.py +23 -0
  11. orionis/services/environment/type_hint.py +559 -0
  12. orionis/test/exceptions/test_config_exception.py +8 -17
  13. orionis/test/exceptions/test_failure_exception.py +27 -27
  14. orionis/test/exceptions/test_persistence_error.py +10 -20
  15. orionis/test/exceptions/test_runtime_error.py +8 -15
  16. orionis/test/exceptions/test_value_error.py +8 -15
  17. orionis/test/logs/history.py +3 -5
  18. {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/METADATA +1 -1
  19. {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/RECORD +66 -62
  20. tests/example/test_example.py +5 -2
  21. tests/foundation/config/app/test_app.py +13 -3
  22. tests/foundation/config/auth/test_auth.py +9 -4
  23. tests/foundation/config/cache/test_cache.py +60 -15
  24. tests/foundation/config/cache/test_cache_file.py +62 -14
  25. tests/foundation/config/cache/test_cache_stores.py +74 -14
  26. tests/foundation/config/cors/test_cors.py +102 -33
  27. tests/foundation/config/database/test_database.py +38 -14
  28. tests/foundation/config/database/test_database_connections.py +79 -5
  29. tests/foundation/config/database/test_database_mysql.py +138 -15
  30. tests/foundation/config/database/test_database_oracle.py +110 -26
  31. tests/foundation/config/database/test_database_pgsql.py +96 -26
  32. tests/foundation/config/database/test_database_sqlite.py +56 -2
  33. tests/foundation/config/exceptions/test_exceptions_integrity.py +44 -10
  34. tests/foundation/config/filesystems/test_filesystems.py +64 -14
  35. tests/foundation/config/filesystems/test_filesystems_aws.py +45 -7
  36. tests/foundation/config/filesystems/test_filesystems_disks.py +78 -8
  37. tests/foundation/config/filesystems/test_filesystems_local.py +66 -18
  38. tests/foundation/config/filesystems/test_filesystems_public.py +37 -0
  39. tests/foundation/config/logging/test_logging.py +75 -11
  40. tests/foundation/config/logging/test_logging_channels.py +79 -2
  41. tests/foundation/config/logging/test_logging_chunked.py +85 -12
  42. tests/foundation/config/logging/test_logging_daily.py +79 -12
  43. tests/foundation/config/logging/test_logging_hourly.py +68 -2
  44. tests/foundation/config/logging/test_logging_monthly.py +48 -2
  45. tests/foundation/config/logging/test_logging_stack.py +49 -14
  46. tests/foundation/config/logging/test_logging_weekly.py +92 -2
  47. tests/foundation/config/mail/test_mail.py +87 -15
  48. tests/foundation/config/mail/test_mail_file.py +40 -4
  49. tests/foundation/config/mail/test_mail_mailers.py +56 -8
  50. tests/foundation/config/mail/test_mail_smtp.py +58 -14
  51. tests/foundation/config/queue/test_queue.py +62 -9
  52. tests/foundation/config/queue/test_queue_brokers.py +27 -10
  53. tests/foundation/config/queue/test_queue_database.py +53 -15
  54. tests/foundation/config/root/test_root_paths.py +69 -2
  55. tests/foundation/config/session/test_session.py +30 -1
  56. tests/foundation/config/startup/test_config_startup.py +77 -7
  57. tests/foundation/config/testing/test_testing.py +68 -0
  58. tests/patterns/singleton/test_singleton.py +10 -1
  59. tests/services/asynchrony/test_async_io.py +4 -4
  60. tests/services/environment/test_env.py +3 -4
  61. tests/testing/test_testing_result.py +56 -19
  62. tests/testing/test_testing_unit.py +93 -24
  63. orionis/services/environment/exceptions/value_exception.py +0 -27
  64. {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/WHEEL +0 -0
  65. {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/licenses/LICENCE +0 -0
  66. {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/top_level.txt +0 -0
  67. {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/zip-safe +0 -0
@@ -2,13 +2,13 @@ from orionis.test.cases.test_case import TestCase
2
2
  from orionis.unittesting import UnitTest, ExecutionMode, UnittestTestLoader, UnittestTestSuite, unittest_mock_patch, UnittestMagicMock, UnittestTestResult
3
3
 
4
4
  class TestUnitTest(TestCase):
5
- """
6
- Test cases for the UnitTest class which handles test discovery and execution.
7
- """
8
5
 
9
- async def testDefaultConfiguration(self):
6
+ async def testDefaultConfiguration(self) -> None:
10
7
  """
11
8
  Test that UnitTest initializes with correct default configuration values.
9
+
10
+ Notes
11
+ -----
12
12
  Verifies that all default attributes are set as expected upon initialization.
13
13
  """
14
14
  unit_test = UnitTest()
@@ -20,10 +20,28 @@ class TestUnitTest(TestCase):
20
20
  self.assertIsInstance(unit_test.loader, UnittestTestLoader)
21
21
  self.assertIsInstance(unit_test.suite, UnittestTestSuite)
22
22
 
23
- async def testConfigureMethod(self):
24
- """
25
- Test that configure method properly updates configuration values.
26
- Verifies that all configuration parameters can be updated through the configure method.
23
+ async def testConfigureMethod(self) -> None:
24
+ """
25
+ Test the `configure` method for correct configuration updates.
26
+ This test verifies that all configuration parameters of the `UnitTest` class
27
+ can be updated through the `configure` method and that the changes are
28
+ reflected in the instance attributes.
29
+
30
+ Parameters
31
+ ----------
32
+ self : TestCase
33
+ The test case instance.
34
+
35
+ Notes
36
+ -----
37
+ The test checks the following configuration parameters:
38
+ - verbosity
39
+ - execution_mode
40
+ - max_workers
41
+ - fail_fast
42
+ - print_result
43
+ - throw_exception
44
+ It also asserts that the `configure` method returns the instance itself.
27
45
  """
28
46
  unit_test = UnitTest()
29
47
  configured = unit_test.configure(
@@ -43,10 +61,17 @@ class TestUnitTest(TestCase):
43
61
  self.assertTrue(unit_test.throw_exception)
44
62
  self.assertEqual(configured, unit_test)
45
63
 
46
- async def testDiscoverTestsInModule(self):
64
+ async def testDiscoverTestsInModule(self) -> None:
47
65
  """
48
- Test that discoverTestsInModule correctly loads tests from a module.
66
+ Test that `discoverTestsInModule` correctly loads tests from a module.
67
+
49
68
  Verifies that tests can be discovered from a module and added to the test suite.
69
+
70
+ Notes
71
+ -----
72
+ This test mocks the loader's `loadTestsFromName` method to ensure that
73
+ `discoverTestsInModule` calls it with the correct arguments and that the
74
+ returned suite is handled as expected.
50
75
  """
51
76
  unit_test = UnitTest()
52
77
  with unittest_mock_patch.object(unit_test.loader, 'loadTestsFromName') as mock_load:
@@ -57,11 +82,22 @@ class TestUnitTest(TestCase):
57
82
  self.assertEqual(result, unit_test)
58
83
  self.assertEqual(len(unit_test.suite._tests), 0)
59
84
 
60
- async def testFlattenTestSuite(self):
85
+ async def testFlattenTestSuite(self) -> None:
61
86
  """
62
- Test that _flattenTestSuite correctly flattens nested test suites.
87
+ Test the _flattenTestSuite method for correct flattening of nested test suites.
88
+ This test verifies that the _flattenTestSuite method of the UnitTest class
89
+ correctly flattens both simple and nested unittest suites into a single list
90
+ of test cases.
91
+
92
+ Parameters
93
+ ----------
94
+ self : TestCase
95
+ The test case instance.
63
96
 
64
- Verifies that both simple and nested test suites are properly flattened.
97
+ Notes
98
+ -----
99
+ - Ensures that nested suites are recursively flattened.
100
+ - Asserts that all test cases from nested suites are present in the flattened result.
65
101
  """
66
102
  unit_test = UnitTest()
67
103
  test_case1 = UnittestMagicMock()
@@ -79,11 +115,16 @@ class TestUnitTest(TestCase):
79
115
  self.assertIn(test_case1, flattened)
80
116
  self.assertIn(test_case2, flattened)
81
117
 
82
- async def testMergeTestResults(self):
118
+ async def testMergeTestResults(self) -> None:
83
119
  """
84
- Test that _mergeTestResults correctly combines test results.
120
+ Test the _mergeTestResults method for correct merging of test results.
121
+ Ensures that the method accurately combines the number of tests run,
122
+ as well as the lists of failures and errors from individual test results.
85
123
 
86
- Verifies that test counts, failures, and errors are properly merged.
124
+ Notes
125
+ -----
126
+ - Verifies that the total number of tests run is updated correctly.
127
+ - Checks that failures and errors are merged without loss of information.
87
128
  """
88
129
  unit_test = UnitTest()
89
130
  combined = UnittestTestResult()
@@ -98,10 +139,22 @@ class TestUnitTest(TestCase):
98
139
  self.assertEqual(len(combined.failures), 1)
99
140
  self.assertEqual(len(combined.errors), 1)
100
141
 
101
- async def testClearTests(self):
142
+ async def testClearTests(self) -> None:
102
143
  """
103
- Test that clearTests method resets the test suite.
104
- Verifies that the test suite is emptied when clearTests is called.
144
+ Test the clearTests method to ensure it resets the test suite.
145
+ This test verifies that after adding a mock test to the suite and calling
146
+ the clearTests method, the suite is emptied as expected.
147
+
148
+ Steps
149
+ -----
150
+ 1. Create an instance of UnitTest.
151
+ 2. Add a mock test to the test suite.
152
+ 3. Call the clearTests method.
153
+ 4. Assert that the test suite is empty.
154
+
155
+ Assertions
156
+ ----------
157
+ - The length of the test suite should be zero after calling clearTests.
105
158
  """
106
159
  unit_test = UnitTest()
107
160
  mock_test = UnittestMagicMock()
@@ -110,10 +163,16 @@ class TestUnitTest(TestCase):
110
163
  unit_test.clearTests()
111
164
  self.assertEqual(len(unit_test.suite._tests), 0)
112
165
 
113
- async def testGetTestNames(self):
166
+ async def testGetTestNames(self) -> None:
114
167
  """
115
- Test that getTestNames returns correct test identifiers.
116
- Verifies that test names are properly extracted from the test suite.
168
+ This test verifies that the `getTestNames` method of the `UnitTest` class
169
+ correctly extracts and returns the identifiers of tests present in the test suite.
170
+
171
+ Notes
172
+ -----
173
+ - Mocks a test case with a predefined identifier.
174
+ - Adds the mock test to the test suite.
175
+ - Asserts that the returned list of test names matches the expected value.
117
176
  """
118
177
  unit_test = UnitTest()
119
178
  mock_test = UnittestMagicMock()
@@ -123,10 +182,20 @@ class TestUnitTest(TestCase):
123
182
  names = unit_test.getTestNames()
124
183
  self.assertEqual(names, ['test_id'])
125
184
 
126
- async def testGetTestCount(self):
185
+ async def testGetTestCount(self) -> None:
127
186
  """
128
- Test that getTestCount returns the correct number of tests.
187
+ Test that `getTestCount` returns the correct number of tests.
188
+
129
189
  Verifies that the count matches the number of tests in the suite.
190
+
191
+ Notes
192
+ -----
193
+ - Adds two mock tests to the suite.
194
+ - Asserts that `getTestCount` returns 2.
195
+
196
+ Returns
197
+ -------
198
+ None
130
199
  """
131
200
  unit_test = UnitTest()
132
201
  mock_test1 = UnittestMagicMock()
@@ -1,27 +0,0 @@
1
- class OrionisEnvironmentValueException(Exception):
2
- """
3
- Exception raised for invalid or unexpected environment values within the Orionis framework.
4
- This exception is intended to signal issues encountered when an environment variable,
5
- configuration value, or similar parameter does not meet the expected criteria or format.
6
- It provides a clear and descriptive error message to facilitate debugging and error handling.
7
- Attributes:
8
- raise OrionisEnvironmentValueException("Invalid value for ORIONIS_MODE: expected 'production' or 'development'.")
9
- msg (str): The error message describing the specific value-related exception.
10
- """
11
-
12
- def __init__(self, msg: str):
13
- """
14
- Initializes the exception with a custom error message.
15
- Args:
16
- msg (str): The error message describing the exception.
17
- """
18
- super().__init__(msg)
19
-
20
- def __str__(self) -> str:
21
- """
22
- Return a string representation of the exception, including the class name and the first argument.
23
-
24
- Returns:
25
- str: A formatted string with the exception class name and its first argument.
26
- """
27
- return f"{self.__class__.__name__}: {self.args[0]}"