orionis 0.405.0__py3-none-any.whl → 0.407.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 (175) hide show
  1. orionis/console/base/command.py +57 -50
  2. orionis/console/base/contracts/command.py +68 -0
  3. orionis/console/dynamic/contracts/progress_bar.py +3 -3
  4. orionis/console/dynamic/progress_bar.py +8 -8
  5. orionis/console/output/console.py +8 -2
  6. orionis/console/output/contracts/console.py +1 -1
  7. orionis/container/container.py +2 -2
  8. orionis/container/context/scope.py +4 -1
  9. orionis/container/contracts/service_provider.py +2 -2
  10. orionis/container/entities/binding.py +31 -44
  11. orionis/container/enums/lifetimes.py +22 -1
  12. orionis/container/facades/facade.py +1 -2
  13. orionis/container/providers/service_provider.py +2 -2
  14. orionis/foundation/application.py +542 -248
  15. orionis/foundation/config/app/entities/app.py +107 -90
  16. orionis/foundation/config/auth/entities/auth.py +4 -33
  17. orionis/foundation/config/cache/entities/cache.py +18 -41
  18. orionis/foundation/config/cache/entities/file.py +8 -35
  19. orionis/foundation/config/cache/entities/stores.py +17 -38
  20. orionis/foundation/config/cors/entities/cors.py +41 -54
  21. orionis/foundation/config/database/entities/connections.py +40 -56
  22. orionis/foundation/config/database/entities/database.py +11 -38
  23. orionis/foundation/config/database/entities/mysql.py +48 -76
  24. orionis/foundation/config/database/entities/oracle.py +30 -57
  25. orionis/foundation/config/database/entities/pgsql.py +45 -61
  26. orionis/foundation/config/database/entities/sqlite.py +26 -53
  27. orionis/foundation/config/filesystems/entitites/aws.py +28 -49
  28. orionis/foundation/config/filesystems/entitites/disks.py +27 -47
  29. orionis/foundation/config/filesystems/entitites/filesystems.py +15 -37
  30. orionis/foundation/config/filesystems/entitites/local.py +9 -35
  31. orionis/foundation/config/filesystems/entitites/public.py +14 -41
  32. orionis/foundation/config/logging/entities/channels.py +56 -86
  33. orionis/foundation/config/logging/entities/chunked.py +9 -9
  34. orionis/foundation/config/logging/entities/daily.py +8 -8
  35. orionis/foundation/config/logging/entities/hourly.py +6 -6
  36. orionis/foundation/config/logging/entities/logging.py +12 -18
  37. orionis/foundation/config/logging/entities/monthly.py +7 -7
  38. orionis/foundation/config/logging/entities/stack.py +5 -5
  39. orionis/foundation/config/logging/entities/weekly.py +6 -6
  40. orionis/foundation/config/mail/entities/file.py +9 -36
  41. orionis/foundation/config/mail/entities/mail.py +22 -40
  42. orionis/foundation/config/mail/entities/mailers.py +29 -44
  43. orionis/foundation/config/mail/entities/smtp.py +47 -48
  44. orionis/foundation/config/queue/entities/brokers.py +19 -41
  45. orionis/foundation/config/queue/entities/database.py +24 -46
  46. orionis/foundation/config/queue/entities/queue.py +28 -40
  47. orionis/foundation/config/roots/paths.py +272 -468
  48. orionis/foundation/config/session/entities/session.py +23 -53
  49. orionis/foundation/config/startup.py +165 -135
  50. orionis/foundation/config/testing/entities/testing.py +137 -122
  51. orionis/foundation/config/testing/enums/__init__.py +6 -2
  52. orionis/foundation/config/testing/enums/drivers.py +16 -0
  53. orionis/foundation/config/testing/enums/verbosity.py +18 -0
  54. orionis/foundation/contracts/application.py +152 -362
  55. orionis/foundation/providers/console_provider.py +24 -2
  56. orionis/foundation/providers/dumper_provider.py +24 -2
  57. orionis/foundation/providers/logger_provider.py +24 -2
  58. orionis/foundation/providers/path_resolver_provider.py +25 -2
  59. orionis/foundation/providers/progress_bar_provider.py +24 -2
  60. orionis/foundation/providers/testing_provider.py +39 -0
  61. orionis/foundation/providers/workers_provider.py +24 -2
  62. orionis/metadata/framework.py +1 -1
  63. orionis/services/asynchrony/contracts/coroutines.py +13 -5
  64. orionis/services/asynchrony/coroutines.py +33 -29
  65. orionis/services/asynchrony/exceptions/exception.py +9 -1
  66. orionis/services/environment/core/dot_env.py +46 -34
  67. orionis/services/environment/enums/__init__.py +0 -0
  68. orionis/services/environment/enums/cast_type.py +42 -0
  69. orionis/services/environment/helpers/functions.py +1 -2
  70. orionis/services/environment/key/__init__.py +0 -0
  71. orionis/services/environment/key/key_generator.py +37 -0
  72. orionis/services/environment/serializer/__init__.py +0 -0
  73. orionis/services/environment/serializer/values.py +21 -0
  74. orionis/services/environment/validators/__init__.py +0 -0
  75. orionis/services/environment/validators/key_name.py +46 -0
  76. orionis/services/environment/validators/types.py +45 -0
  77. orionis/services/system/contracts/imports.py +38 -18
  78. orionis/services/system/contracts/workers.py +29 -12
  79. orionis/services/system/imports.py +65 -25
  80. orionis/services/system/runtime/imports.py +18 -9
  81. orionis/services/system/workers.py +49 -16
  82. orionis/support/entities/__init__.py +0 -0
  83. orionis/support/entities/base.py +104 -0
  84. orionis/support/facades/testing.py +15 -0
  85. orionis/support/facades/workers.py +1 -1
  86. orionis/test/cases/asynchronous.py +0 -11
  87. orionis/test/cases/synchronous.py +0 -9
  88. orionis/test/contracts/dumper.py +11 -4
  89. orionis/test/contracts/kernel.py +5 -110
  90. orionis/test/contracts/logs.py +27 -65
  91. orionis/test/contracts/printer.py +16 -128
  92. orionis/test/contracts/test_result.py +100 -0
  93. orionis/test/contracts/unit_test.py +87 -150
  94. orionis/test/core/unit_test.py +608 -554
  95. orionis/test/entities/result.py +22 -2
  96. orionis/test/enums/__init__.py +0 -2
  97. orionis/test/enums/status.py +14 -9
  98. orionis/test/exceptions/config.py +9 -1
  99. orionis/test/exceptions/failure.py +34 -11
  100. orionis/test/exceptions/persistence.py +10 -2
  101. orionis/test/exceptions/runtime.py +9 -1
  102. orionis/test/exceptions/value.py +13 -1
  103. orionis/test/kernel.py +87 -289
  104. orionis/test/output/dumper.py +83 -18
  105. orionis/test/output/printer.py +399 -156
  106. orionis/test/records/logs.py +203 -82
  107. orionis/test/validators/__init__.py +33 -0
  108. orionis/test/validators/base_path.py +45 -0
  109. orionis/test/validators/execution_mode.py +45 -0
  110. orionis/test/validators/fail_fast.py +37 -0
  111. orionis/test/validators/folder_path.py +34 -0
  112. orionis/test/validators/module_name.py +31 -0
  113. orionis/test/validators/name_pattern.py +40 -0
  114. orionis/test/validators/pattern.py +36 -0
  115. orionis/test/validators/persistent.py +42 -0
  116. orionis/test/validators/persistent_driver.py +43 -0
  117. orionis/test/validators/print_result.py +37 -0
  118. orionis/test/validators/tags.py +37 -0
  119. orionis/test/validators/throw_exception.py +39 -0
  120. orionis/test/validators/verbosity.py +37 -0
  121. orionis/test/validators/web_report.py +35 -0
  122. orionis/test/validators/workers.py +31 -0
  123. orionis/test/view/render.py +48 -54
  124. {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/METADATA +1 -1
  125. {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/RECORD +170 -112
  126. tests/container/__init__.py +0 -0
  127. tests/container/context/__init__.py +0 -0
  128. tests/container/context/test_manager.py +27 -0
  129. tests/container/context/test_scope.py +23 -0
  130. tests/container/entities/__init__.py +0 -0
  131. tests/container/entities/test_binding.py +133 -0
  132. tests/container/enums/__init__.py +0 -0
  133. tests/container/enums/test_lifetimes.py +63 -0
  134. tests/container/facades/__init__.py +0 -0
  135. tests/container/facades/test_facade.py +61 -0
  136. tests/container/mocks/__init__.py +0 -0
  137. tests/container/mocks/mock_complex_classes.py +482 -0
  138. tests/container/mocks/mock_simple_classes.py +32 -0
  139. tests/container/providers/__init__.py +0 -0
  140. tests/container/providers/test_providers.py +48 -0
  141. tests/container/resolver/__init__.py +0 -0
  142. tests/container/resolver/test_resolver.py +55 -0
  143. tests/container/test_container.py +254 -0
  144. tests/container/test_singleton.py +98 -0
  145. tests/container/test_thread_safety.py +217 -0
  146. tests/container/validators/__init__.py +0 -0
  147. tests/container/validators/test_implements.py +140 -0
  148. tests/container/validators/test_is_abstract_class.py +99 -0
  149. tests/container/validators/test_is_callable.py +73 -0
  150. tests/container/validators/test_is_concrete_class.py +97 -0
  151. tests/container/validators/test_is_instance.py +105 -0
  152. tests/container/validators/test_is_not_subclass.py +117 -0
  153. tests/container/validators/test_is_subclass.py +115 -0
  154. tests/container/validators/test_is_valid_alias.py +113 -0
  155. tests/container/validators/test_lifetime.py +75 -0
  156. tests/example/test_example.py +2 -2
  157. tests/foundation/config/testing/test_foundation_config_testing.py +1 -1
  158. tests/metadata/test_metadata_framework.py +89 -24
  159. tests/metadata/test_metadata_package.py +55 -10
  160. tests/services/asynchrony/test_services_asynchrony_coroutine.py +52 -7
  161. tests/services/system/test_services_system_imports.py +119 -16
  162. tests/services/system/test_services_system_workers.py +71 -30
  163. tests/testing/test_testing_result.py +117 -117
  164. tests/testing/test_testing_unit.py +209 -209
  165. orionis/foundation/config/base.py +0 -112
  166. orionis/test/arguments/parser.py +0 -187
  167. orionis/test/contracts/parser.py +0 -43
  168. orionis/test/entities/arguments.py +0 -38
  169. orionis/test/enums/execution_mode.py +0 -16
  170. /orionis/{test/arguments → console/base/contracts}/__init__.py +0 -0
  171. /orionis/foundation/config/testing/enums/{test_mode.py → mode.py} +0 -0
  172. {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/WHEEL +0 -0
  173. {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/licenses/LICENCE +0 -0
  174. {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/top_level.txt +0 -0
  175. {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,133 @@
1
+ from orionis.container.entities.binding import Binding
2
+ from orionis.container.enums.lifetimes import Lifetime
3
+ from orionis.container.exceptions.type import OrionisContainerTypeError
4
+ from orionis.test.cases.asynchronous import AsyncTestCase
5
+
6
+ class TestBinding(AsyncTestCase):
7
+
8
+ async def testBindingInitialization(self):
9
+ """
10
+ Test that a Binding can be initialized with default values.
11
+
12
+ Raises
13
+ ------
14
+ AssertionError
15
+ If the Binding initialization fails or default values are incorrect.
16
+ """
17
+ binding: Binding = Binding()
18
+ self.assertIsNone(binding.contract)
19
+ self.assertIsNone(binding.concrete)
20
+ self.assertIsNone(binding.instance)
21
+ self.assertIsNone(binding.function)
22
+ self.assertEqual(binding.lifetime, Lifetime.TRANSIENT)
23
+ self.assertFalse(binding.enforce_decoupling)
24
+ self.assertIsNone(binding.alias)
25
+
26
+ async def testBindingCustomValues(self):
27
+ """
28
+ Test that a Binding can be initialized with custom values.
29
+
30
+ Raises
31
+ ------
32
+ AssertionError
33
+ If the Binding initialization fails or custom values are not set correctly.
34
+ """
35
+ class TestContract: pass
36
+ class TestConcrete: pass
37
+
38
+ instance = TestConcrete()
39
+ factory_func = lambda: TestConcrete()
40
+
41
+ binding = Binding(
42
+ contract=TestContract,
43
+ concrete=TestConcrete,
44
+ instance=instance,
45
+ function=factory_func,
46
+ lifetime=Lifetime.SINGLETON,
47
+ enforce_decoupling=True,
48
+ alias="test_binding"
49
+ )
50
+
51
+ self.assertIs(binding.contract, TestContract)
52
+ self.assertIs(binding.concrete, TestConcrete)
53
+ self.assertIs(binding.instance, instance)
54
+ self.assertIs(binding.function, factory_func)
55
+ self.assertEqual(binding.lifetime, Lifetime.SINGLETON)
56
+ self.assertTrue(binding.enforce_decoupling)
57
+ self.assertEqual(binding.alias, "test_binding")
58
+
59
+ async def testBindingPostInitValidation(self):
60
+ """
61
+ Test that __post_init__ validation works correctly.
62
+
63
+ Raises
64
+ ------
65
+ AssertionError
66
+ If validation errors are not raised appropriately.
67
+ """
68
+ # Test invalid lifetime
69
+ with self.assertRaises(OrionisContainerTypeError):
70
+ Binding(lifetime="not_a_lifetime")
71
+
72
+ # Test invalid enforce_decoupling
73
+ with self.assertRaises(OrionisContainerTypeError):
74
+ Binding(enforce_decoupling="not_a_bool")
75
+
76
+ # Test invalid alias
77
+ with self.assertRaises(OrionisContainerTypeError):
78
+ Binding(alias=123)
79
+
80
+ async def testToDictMethod(self):
81
+ """
82
+ Test that toDict method returns a correct dictionary representation.
83
+
84
+ Raises
85
+ ------
86
+ AssertionError
87
+ If the dictionary representation is incorrect.
88
+ """
89
+ class TestContract: pass
90
+ class TestConcrete: pass
91
+
92
+ binding = Binding(
93
+ contract=TestContract,
94
+ concrete=TestConcrete,
95
+ lifetime=Lifetime.SINGLETON,
96
+ enforce_decoupling=True,
97
+ alias="test_binding"
98
+ )
99
+
100
+ result = binding.toDict()
101
+
102
+ self.assertIsInstance(result, dict)
103
+ self.assertIs(result["contract"], TestContract)
104
+ self.assertIs(result["concrete"], TestConcrete)
105
+ self.assertIsNone(result["instance"])
106
+ self.assertIsNone(result["function"])
107
+ self.assertEqual(result["lifetime"], Lifetime.SINGLETON)
108
+ self.assertTrue(result["enforce_decoupling"])
109
+ self.assertEqual(result["alias"], "test_binding")
110
+
111
+ async def testGetFieldsMethod(self):
112
+ """
113
+ Test that getFields method returns correct field information.
114
+
115
+ Raises
116
+ ------
117
+ AssertionError
118
+ If the field information is incorrect.
119
+ """
120
+ binding = Binding()
121
+ fields_info = binding.getFields()
122
+
123
+ self.assertIsInstance(fields_info, list)
124
+ self.assertEqual(len(fields_info), 7)
125
+
126
+ field_names = [field["name"] for field in fields_info]
127
+ expected_names = ["contract", "concrete", "instance", "function","lifetime", "enforce_decoupling", "alias"]
128
+ self.assertTrue(all(name in field_names for name in expected_names))
129
+
130
+ # Test specific field information
131
+ lifetime_field = next(field for field in fields_info if field["name"] == "lifetime")
132
+ self.assertEqual(lifetime_field["default"], Lifetime.TRANSIENT.value)
133
+ self.assertIn("description", lifetime_field["metadata"])
File without changes
@@ -0,0 +1,63 @@
1
+ from orionis.container.enums.lifetimes import Lifetime
2
+ from orionis.test.cases.asynchronous import AsyncTestCase
3
+
4
+ class TestLifetime(AsyncTestCase):
5
+ """
6
+ Test cases for the Lifetime enum in orionis.container.enums.lifetimes.
7
+
8
+ Notes
9
+ -----
10
+ This test suite validates the enumeration values and behavior of the Lifetime enum
11
+ which defines the lifecycle types for dependency injection.
12
+ """
13
+
14
+ async def testLifetimeValuesExist(self) -> None:
15
+ """
16
+ Test that the Lifetime enum contains the expected values.
17
+
18
+ Verifies that TRANSIENT, SINGLETON, and SCOPED values are present in the enum.
19
+ """
20
+ self.assertIn(Lifetime.TRANSIENT, Lifetime)
21
+ self.assertIn(Lifetime.SINGLETON, Lifetime)
22
+ self.assertIn(Lifetime.SCOPED, Lifetime)
23
+
24
+ async def testLifetimeValuesAreUnique(self) -> None:
25
+ """
26
+ Test that all Lifetime enum values are unique.
27
+
28
+ Ensures that each enum value has a distinct integer value.
29
+ """
30
+ values = [member.value for member in Lifetime]
31
+ self.assertEqual(len(values), len(set(values)))
32
+
33
+ async def testLifetimeCount(self) -> None:
34
+ """
35
+ Test that the Lifetime enum has exactly 3 members.
36
+
37
+ Verifies that no additional or missing lifecycle types exist.
38
+ """
39
+ self.assertEqual(len(list(Lifetime)), 3)
40
+
41
+ async def testLifetimeStringRepresentation(self) -> None:
42
+ """
43
+ Test the string representation of Lifetime enum values.
44
+
45
+ Verifies that the string representation of enum values matches their names.
46
+ """
47
+ self.assertEqual(str(Lifetime.TRANSIENT), "Lifetime.TRANSIENT")
48
+ self.assertEqual(str(Lifetime.SINGLETON), "Lifetime.SINGLETON")
49
+ self.assertEqual(str(Lifetime.SCOPED), "Lifetime.SCOPED")
50
+
51
+ async def testLifetimeComparison(self) -> None:
52
+ """
53
+ Test comparison operations between Lifetime enum values.
54
+
55
+ Verifies that enum values can be correctly compared with each other.
56
+ """
57
+ self.assertNotEqual(Lifetime.TRANSIENT, Lifetime.SINGLETON)
58
+ self.assertNotEqual(Lifetime.SINGLETON, Lifetime.SCOPED)
59
+ self.assertNotEqual(Lifetime.TRANSIENT, Lifetime.SCOPED)
60
+
61
+ self.assertEqual(Lifetime.TRANSIENT, Lifetime.TRANSIENT)
62
+ self.assertEqual(Lifetime.SINGLETON, Lifetime.SINGLETON)
63
+ self.assertEqual(Lifetime.SCOPED, Lifetime.SCOPED)
File without changes
@@ -0,0 +1,61 @@
1
+ import inspect
2
+ from orionis.container.facades.facade import FacadeMeta, Facade
3
+ from orionis.test.cases.asynchronous import AsyncTestCase
4
+
5
+ class TestFacadeMethods(AsyncTestCase):
6
+
7
+ async def testFacadeMethodsExist(self):
8
+ """
9
+ Verify the existence of essential methods in the Facade and FacadeMeta classes.
10
+
11
+ This test ensures that the following methods are implemented:
12
+ - 'getFacadeAccessor' in the Facade class
13
+ - 'resolve' in the Facade class
14
+ - '__getattr__' in the FacadeMeta class
15
+
16
+ Returns:
17
+ None. The method asserts the presence of required methods and raises AssertionError if any are missing.
18
+ """
19
+
20
+ expected_methods = [
21
+ ("getFacadeAccessor", Facade),
22
+ ("resolve", Facade),
23
+ ("__getattr__", FacadeMeta),
24
+ ]
25
+
26
+ # Check each expected method for existence in its respective class
27
+ for method_name, cls in expected_methods:
28
+ self.assertTrue(
29
+ hasattr(cls, method_name),
30
+ f"Method '{method_name}' does not exist in {cls.__name__}."
31
+ )
32
+
33
+ async def testFacadeMethodSignatures(self):
34
+ """
35
+ Validate the method signatures of key Facade and FacadeMeta class methods.
36
+
37
+ This test checks that:
38
+ - 'getFacadeAccessor' in Facade accepts no parameters.
39
+ - 'resolve' in Facade accepts variable positional and keyword arguments.
40
+ - '__getattr__' in FacadeMeta accepts 'cls' and 'name' as parameters.
41
+
42
+ Returns:
43
+ None. The method asserts correct method signatures and raises AssertionError if any signature does not match expectations.
44
+ """
45
+
46
+ # Check that getFacadeAccessor has no parameters
47
+ sig = inspect.signature(Facade.getFacadeAccessor)
48
+ params = list(sig.parameters.values())
49
+ self.assertEqual(len(params), 0)
50
+
51
+ # Check that resolve has *args and **kwargs as parameters
52
+ sig = inspect.signature(Facade.resolve)
53
+ params = list(sig.parameters.values())
54
+ self.assertEqual(params[0].name, "args")
55
+ self.assertEqual(params[1].kind, inspect.Parameter.VAR_KEYWORD)
56
+
57
+ # Check that __getattr__ has 'cls' and 'name' as parameters
58
+ sig = inspect.signature(FacadeMeta.__getattr__)
59
+ params = list(sig.parameters.values())
60
+ self.assertEqual(params[0].name, "cls")
61
+ self.assertEqual(params[1].name, "name")
File without changes