orionis 0.405.0__py3-none-any.whl → 0.406.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 (154) 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/environment/helpers/functions.py +1 -2
  64. orionis/services/environment/key/__init__.py +0 -0
  65. orionis/services/environment/key/key_generator.py +37 -0
  66. orionis/support/entities/__init__.py +0 -0
  67. orionis/support/entities/base.py +104 -0
  68. orionis/support/facades/testing.py +15 -0
  69. orionis/support/facades/workers.py +1 -1
  70. orionis/test/cases/asynchronous.py +0 -11
  71. orionis/test/cases/synchronous.py +0 -9
  72. orionis/test/contracts/dumper.py +11 -4
  73. orionis/test/contracts/kernel.py +5 -110
  74. orionis/test/contracts/logs.py +27 -65
  75. orionis/test/contracts/printer.py +16 -128
  76. orionis/test/contracts/test_result.py +100 -0
  77. orionis/test/contracts/unit_test.py +87 -150
  78. orionis/test/core/unit_test.py +608 -554
  79. orionis/test/entities/result.py +22 -2
  80. orionis/test/enums/__init__.py +0 -2
  81. orionis/test/enums/status.py +14 -9
  82. orionis/test/exceptions/config.py +9 -1
  83. orionis/test/exceptions/failure.py +34 -11
  84. orionis/test/exceptions/persistence.py +10 -2
  85. orionis/test/exceptions/runtime.py +9 -1
  86. orionis/test/exceptions/value.py +13 -1
  87. orionis/test/kernel.py +87 -289
  88. orionis/test/output/dumper.py +82 -18
  89. orionis/test/output/printer.py +399 -156
  90. orionis/test/records/logs.py +203 -82
  91. orionis/test/validators/__init__.py +33 -0
  92. orionis/test/validators/base_path.py +45 -0
  93. orionis/test/validators/execution_mode.py +45 -0
  94. orionis/test/validators/fail_fast.py +37 -0
  95. orionis/test/validators/folder_path.py +34 -0
  96. orionis/test/validators/module_name.py +31 -0
  97. orionis/test/validators/name_pattern.py +40 -0
  98. orionis/test/validators/pattern.py +36 -0
  99. orionis/test/validators/persistent.py +42 -0
  100. orionis/test/validators/persistent_driver.py +43 -0
  101. orionis/test/validators/print_result.py +37 -0
  102. orionis/test/validators/tags.py +37 -0
  103. orionis/test/validators/throw_exception.py +39 -0
  104. orionis/test/validators/verbosity.py +37 -0
  105. orionis/test/validators/web_report.py +35 -0
  106. orionis/test/validators/workers.py +31 -0
  107. orionis/test/view/render.py +48 -54
  108. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/METADATA +1 -1
  109. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/RECORD +149 -98
  110. tests/container/__init__.py +0 -0
  111. tests/container/context/__init__.py +0 -0
  112. tests/container/context/test_manager.py +27 -0
  113. tests/container/context/test_scope.py +23 -0
  114. tests/container/entities/__init__.py +0 -0
  115. tests/container/entities/test_binding.py +133 -0
  116. tests/container/enums/__init__.py +0 -0
  117. tests/container/enums/test_lifetimes.py +63 -0
  118. tests/container/facades/__init__.py +0 -0
  119. tests/container/facades/test_facade.py +61 -0
  120. tests/container/mocks/__init__.py +0 -0
  121. tests/container/mocks/mock_complex_classes.py +482 -0
  122. tests/container/mocks/mock_simple_classes.py +32 -0
  123. tests/container/providers/__init__.py +0 -0
  124. tests/container/providers/test_providers.py +48 -0
  125. tests/container/resolver/__init__.py +0 -0
  126. tests/container/resolver/test_resolver.py +55 -0
  127. tests/container/test_container.py +254 -0
  128. tests/container/test_singleton.py +98 -0
  129. tests/container/test_thread_safety.py +217 -0
  130. tests/container/validators/__init__.py +0 -0
  131. tests/container/validators/test_implements.py +140 -0
  132. tests/container/validators/test_is_abstract_class.py +99 -0
  133. tests/container/validators/test_is_callable.py +73 -0
  134. tests/container/validators/test_is_concrete_class.py +97 -0
  135. tests/container/validators/test_is_instance.py +105 -0
  136. tests/container/validators/test_is_not_subclass.py +117 -0
  137. tests/container/validators/test_is_subclass.py +115 -0
  138. tests/container/validators/test_is_valid_alias.py +113 -0
  139. tests/container/validators/test_lifetime.py +75 -0
  140. tests/foundation/config/testing/test_foundation_config_testing.py +1 -1
  141. tests/metadata/test_metadata_framework.py +18 -18
  142. tests/testing/test_testing_result.py +117 -117
  143. tests/testing/test_testing_unit.py +209 -209
  144. orionis/foundation/config/base.py +0 -112
  145. orionis/test/arguments/parser.py +0 -187
  146. orionis/test/contracts/parser.py +0 -43
  147. orionis/test/entities/arguments.py +0 -38
  148. orionis/test/enums/execution_mode.py +0 -16
  149. /orionis/{test/arguments → console/base/contracts}/__init__.py +0 -0
  150. /orionis/foundation/config/testing/enums/{test_mode.py → mode.py} +0 -0
  151. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/WHEEL +0 -0
  152. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/licenses/LICENCE +0 -0
  153. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/top_level.txt +0 -0
  154. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/zip-safe +0 -0
@@ -3,15 +3,37 @@ from orionis.console.output.contracts.console import IConsole
3
3
  from orionis.container.providers.service_provider import ServiceProvider
4
4
 
5
5
  class ConsoleProvider(ServiceProvider):
6
+ """
7
+ ConsoleProvider
8
+ ===============
9
+
10
+ Registers the console output service in the application container.
11
+ Provides access to various console output features, including information, warnings, errors, debug messages, tables, confirmations, and password prompts.
12
+
13
+ Methods
14
+ -------
15
+ register()
16
+ Registers the console service in the application container.
17
+ boot()
18
+ Performs post-registration initialization if needed.
19
+ """
6
20
 
7
21
  def register(self) -> None:
8
22
  """
9
- Register services into the application container.
23
+ Registers the console service in the application container.
24
+
25
+ Returns
26
+ -------
27
+ None
10
28
  """
11
29
  self.app.transient(IConsole, Console, alias="core.orionis.console")
12
30
 
13
31
  def boot(self) -> None:
14
32
  """
15
- Perform any post-registration bootstrapping or initialization.
33
+ Performs post-registration initialization if needed.
34
+
35
+ Returns
36
+ -------
37
+ None
16
38
  """
17
39
  pass
@@ -3,15 +3,37 @@ from orionis.console.dumper.contracts.dump import IDebug
3
3
  from orionis.container.providers.service_provider import ServiceProvider
4
4
 
5
5
  class DumperProvider(ServiceProvider):
6
+ """
7
+ DumperProvider
8
+ ==============
9
+
10
+ Registers the debug message service in the application container.
11
+ Provides access to debug message printing, error reporting, and other console diagnostics.
12
+
13
+ Methods
14
+ -------
15
+ register()
16
+ Registers the debug service in the application container.
17
+ boot()
18
+ Performs post-registration initialization if needed.
19
+ """
6
20
 
7
21
  def register(self) -> None:
8
22
  """
9
- Register services into the application container.
23
+ Registers the debug service in the application container.
24
+
25
+ Returns
26
+ -------
27
+ None
10
28
  """
11
29
  self.app.transient(IDebug, Debug, alias="core.orionis.dumper")
12
30
 
13
31
  def boot(self) -> None:
14
32
  """
15
- Perform any post-registration bootstrapping or initialization.
33
+ Performs post-registration initialization if needed.
34
+
35
+ Returns
36
+ -------
37
+ None
16
38
  """
17
39
  pass
@@ -3,15 +3,37 @@ from orionis.services.log.contracts.log_service import ILoggerService
3
3
  from orionis.services.log.log_service import LoggerService
4
4
 
5
5
  class LoggerProvider(ServiceProvider):
6
+ """
7
+ LoggerProvider
8
+ ==============
9
+
10
+ Registers the logging service in the application container.
11
+ Provides a `LoggerService` instance for application-wide logging.
12
+
13
+ Methods
14
+ -------
15
+ register()
16
+ Registers the logging service in the application container.
17
+ boot()
18
+ Performs post-registration initialization if needed.
19
+ """
6
20
 
7
21
  def register(self) -> None:
8
22
  """
9
- Register services into the application container.
23
+ Registers the logging service in the application container.
24
+
25
+ Returns
26
+ -------
27
+ None
10
28
  """
11
29
  self.app.instance(ILoggerService, LoggerService(self.app.config('logging')), alias="core.orionis.logger")
12
30
 
13
31
  def boot(self) -> None:
14
32
  """
15
- Perform any post-registration bootstrapping or initialization.
33
+ Performs post-registration initialization if needed.
34
+
35
+ Returns
36
+ -------
37
+ None
16
38
  """
17
39
  pass
@@ -3,15 +3,38 @@ from orionis.services.paths.contracts.resolver import IResolver
3
3
  from orionis.services.paths.resolver import Resolver
4
4
 
5
5
  class PathResolverProvider(ServiceProvider):
6
+ """
7
+ PathResolverProvider
8
+ ===================
9
+
10
+ Registers the path resolution service in the application container.
11
+ Provides compatibility with the file system for resolving paths.
12
+
13
+ Methods
14
+ -------
15
+ register()
16
+ Registers the path resolver service in the application container.
17
+ boot()
18
+ Performs post-registration initialization if needed.
19
+ """
20
+
6
21
 
7
22
  def register(self) -> None:
8
23
  """
9
- Register services into the application container.
24
+ Registers the path resolver service in the application container.
25
+
26
+ Returns
27
+ -------
28
+ None
10
29
  """
11
30
  self.app.transient(IResolver, Resolver, alias="core.orionis.path_resolver")
12
31
 
13
32
  def boot(self) -> None:
14
33
  """
15
- Perform any post-registration bootstrapping or initialization.
34
+ Performs post-registration initialization if needed.
35
+
36
+ Returns
37
+ -------
38
+ None
16
39
  """
17
40
  pass
@@ -3,15 +3,37 @@ from orionis.console.dynamic.progress_bar import ProgressBar
3
3
  from orionis.container.providers.service_provider import ServiceProvider
4
4
 
5
5
  class ProgressBarProvider(ServiceProvider):
6
+ """
7
+ ProgressBarProvider
8
+ ===================
9
+
10
+ Registers the dynamic progress bar service in the application container.
11
+ Provides a console progress bar for visual feedback during operations.
12
+
13
+ Methods
14
+ -------
15
+ register()
16
+ Registers the progress bar service in the application container.
17
+ boot()
18
+ Performs post-registration initialization if needed.
19
+ """
6
20
 
7
21
  def register(self) -> None:
8
22
  """
9
- Register services into the application container.
23
+ Registers the progress bar service in the application container.
24
+
25
+ Returns
26
+ -------
27
+ None
10
28
  """
11
29
  self.app.transient(IProgressBar, ProgressBar, alias="core.orionis.progress_bar")
12
30
 
13
31
  def boot(self) -> None:
14
32
  """
15
- Perform any post-registration bootstrapping or initialization.
33
+ Performs post-registration initialization if needed.
34
+
35
+ Returns
36
+ -------
37
+ None
16
38
  """
17
39
  pass
@@ -0,0 +1,39 @@
1
+ from orionis.container.providers.service_provider import ServiceProvider
2
+ from orionis.test.contracts.unit_test import IUnitTest
3
+ from orionis.test.core.unit_test import UnitTest
4
+
5
+ class TestingProvider(ServiceProvider):
6
+ """
7
+ TestingProvider
8
+ ===============
9
+
10
+ Registers the unit testing environment service in the application container.
11
+ Provides a native unit testing framework for Orionis with features beyond common frameworks.
12
+
13
+ Methods
14
+ -------
15
+ register()
16
+ Registers the unit testing service in the application container.
17
+ boot()
18
+ Performs post-registration initialization if needed.
19
+ """
20
+
21
+ def register(self) -> None:
22
+ """
23
+ Registers the unit testing service in the application container.
24
+
25
+ Returns
26
+ -------
27
+ None
28
+ """
29
+ self.app.singleton(IUnitTest, UnitTest, alias="core.orionis.testing")
30
+
31
+ def boot(self) -> None:
32
+ """
33
+ Performs post-registration initialization if needed.
34
+
35
+ Returns
36
+ -------
37
+ None
38
+ """
39
+ pass
@@ -3,15 +3,37 @@ from orionis.services.system.contracts.workers import IWorkers
3
3
  from orionis.services.system.workers import Workers
4
4
 
5
5
  class WorkersProvider(ServiceProvider):
6
+ """
7
+ WorkersProvider
8
+ ===============
9
+
10
+ Registers the worker management service in the application container.
11
+ Determines the optimal number of workers to start based on system analysis.
12
+
13
+ Methods
14
+ -------
15
+ register()
16
+ Registers the worker service in the application container.
17
+ boot()
18
+ Performs post-registration initialization if needed.
19
+ """
6
20
 
7
21
  def register(self) -> None:
8
22
  """
9
- Register services into the application container.
23
+ Registers the worker service in the application container.
24
+
25
+ Returns
26
+ -------
27
+ None
10
28
  """
11
29
  self.app.transient(IWorkers, Workers, alias="core.orionis.workers")
12
30
 
13
31
  def boot(self) -> None:
14
32
  """
15
- Perform any post-registration bootstrapping or initialization.
33
+ Performs post-registration initialization if needed.
34
+
35
+ Returns
36
+ -------
37
+ None
16
38
  """
17
39
  pass
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.405.0"
8
+ VERSION = "0.406.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -17,5 +17,4 @@ def env(key: str, default: Any = None) -> Any:
17
17
  Any
18
18
  The value of the environment variable if it exists, otherwise the default value.
19
19
  """
20
- dotenv = DotEnv()
21
- return dotenv.get(key, default)
20
+ return DotEnv().get(key, default)
File without changes
@@ -0,0 +1,37 @@
1
+ import os
2
+ import base64
3
+
4
+ class SecureKeyGenerator:
5
+ """
6
+ Provides static methods for generating secure random keys in base64 format.
7
+
8
+ Methods
9
+ -------
10
+ generate_key() : str
11
+ Generates a secure random key encoded in base64.
12
+ """
13
+
14
+ @staticmethod
15
+ def generate() -> str:
16
+ """
17
+ Generates a secure random key and encodes it in base64 format.
18
+
19
+ This method creates a cryptographically secure random key of 32 bytes,
20
+ encodes it using base64 encoding, and returns the result as a string
21
+ prefixed with 'base64:'.
22
+
23
+ Returns
24
+ -------
25
+ str
26
+ A string in the format 'base64:<key>', where <key> is a base64-encoded
27
+ representation of a securely generated 32-byte random key.
28
+ """
29
+
30
+ # Generate 32 bytes of cryptographically secure random data
31
+ key = os.urandom(32)
32
+
33
+ # Encode the random bytes using base64 and decode to a UTF-8 string
34
+ encoded = base64.b64encode(key).decode('utf-8')
35
+
36
+ # Return the key in the required format
37
+ return f"base64:{encoded}"
File without changes
@@ -0,0 +1,104 @@
1
+ from dataclasses import asdict, fields, is_dataclass, MISSING
2
+ from enum import Enum
3
+
4
+ class BaseEntity:
5
+
6
+ def toDict(self) -> dict:
7
+ """
8
+ Converts the current instance into a dictionary representation.
9
+
10
+ Returns
11
+ -------
12
+ dict
13
+ Dictionary representation of the current instance.
14
+ """
15
+ return asdict(self)
16
+
17
+ def getFields(self):
18
+ """
19
+ Retrieves a list of field information for the current dataclass instance.
20
+
21
+ Returns
22
+ -------
23
+ list
24
+ A list of dictionaries, each containing details about a field:
25
+ - name (str): The name of the field.
26
+ - type (type): The type of the field.
27
+ - default: The default value of the field, if specified; otherwise, the value from metadata or None.
28
+ - metadata (mapping): The metadata associated with the field.
29
+ """
30
+ # Dictionary to hold field information
31
+ __fields = []
32
+
33
+ # Iterate over the fields of the dataclass and extract relevant information
34
+ for field in fields(self):
35
+
36
+ # Get the field name
37
+ __name = field.name
38
+
39
+ # Get the field type with better handling for complex types
40
+ __type = getattr(field.type, '__name__', None)
41
+
42
+ # If the type is None, handle it
43
+ if __type is None:
44
+
45
+ # Handle Union types or other complex types
46
+ type_lst = []
47
+ type_str = str(field.type).split('|')
48
+ for itype in type_str:
49
+ type_lst.append(itype.strip())
50
+ __type = type_lst
51
+
52
+ # Ensure __type is a list for consistency
53
+ __type = type_lst if isinstance(__type, list) else [__type]
54
+
55
+ # Extract metadata, default value, and type
56
+ metadata = dict(field.metadata) if field.metadata else {}
57
+
58
+ # If metadata contains a default value, normalize it
59
+ if 'default' in metadata:
60
+ metadata_default = metadata['default']
61
+ if callable(metadata_default):
62
+ metadata_default = metadata_default()
63
+ if is_dataclass(metadata_default):
64
+ metadata_default = asdict(metadata_default)
65
+ elif isinstance(metadata_default, Enum):
66
+ metadata_default = metadata_default.value
67
+ metadata['default'] = metadata_default
68
+
69
+ # Add the field information to the list
70
+ __metadata = metadata
71
+
72
+ # Extract the default value, if specified
73
+ __default = None
74
+
75
+ # Field has a direct default value
76
+ if field.default is not MISSING:
77
+ __default = field.default() if callable(field.default) else field.default
78
+ if is_dataclass(__default):
79
+ __default = asdict(__default)
80
+ elif isinstance(__default, Enum):
81
+ __default = __default.value
82
+
83
+ # Field has a default factory (like list, dict, etc.)
84
+ elif field.default_factory is not MISSING:
85
+ __default = field.default_factory() if callable(field.default_factory) else field.default_factory
86
+ if is_dataclass(__default):
87
+ __default = asdict(__default)
88
+ elif isinstance(__default, Enum):
89
+ __default = __default.value
90
+
91
+ # No default found, check metadata for custom default
92
+ else:
93
+ __default = __metadata.get('default', None)
94
+
95
+ # Append the field information to the list
96
+ __fields.append({
97
+ "name": __name,
98
+ "types": __type,
99
+ "default": __default,
100
+ "metadata": __metadata
101
+ })
102
+
103
+ # Return the list of field information
104
+ return __fields
@@ -0,0 +1,15 @@
1
+ from orionis.container.facades.facade import Facade
2
+
3
+ class Test(Facade):
4
+
5
+ @classmethod
6
+ def getFacadeAccessor(cls) -> str:
7
+ """
8
+ Get the service container binding key for the dumper component.
9
+
10
+ Returns
11
+ -------
12
+ str
13
+ The service container binding key.
14
+ """
15
+ return "core.orionis.testing"
@@ -1,6 +1,6 @@
1
1
  from orionis.container.facades.facade import Facade
2
2
 
3
- class ProgressBar(Facade):
3
+ class Workers(Facade):
4
4
 
5
5
  @classmethod
6
6
  def getFacadeAccessor(cls):
@@ -30,17 +30,6 @@ class AsyncTestCase(unittest.IsolatedAsyncioTestCase, TestDumper):
30
30
  Hook method for subclass-specific async setup logic.
31
31
  onAsyncTeardown()
32
32
  Hook method for subclass-specific async teardown logic.
33
-
34
- Examples
35
- --------
36
- >>> class MyAsyncTest(AsyncTestCase):
37
- ... async def onAsyncSetup(self):
38
- ... self.client = AsyncHttpClient()
39
- ... await self.client.connect()
40
- ...
41
- ... async def testAsyncOperation(self):
42
- ... result = await self.client.get('/api/data')
43
- ... self.assertEqual(result.status, 200)
44
33
  """
45
34
 
46
35
  async def asyncSetUp(self):
@@ -27,15 +27,6 @@ class SyncTestCase(unittest.TestCase, TestDumper):
27
27
  Hook method for subclass-specific setup logic.
28
28
  onTeardown()
29
29
  Hook method for subclass-specific teardown logic.
30
-
31
- Examples
32
- --------
33
- >>> class MyTest(SyncTestCase):
34
- ... def onSetup(self):
35
- ... self.data = [1, 2, 3]
36
- ...
37
- ... def testExample(self):
38
- ... self.assertEqual(len(self.data), 3)
39
30
  """
40
31
 
41
32
  def setUp(self):
@@ -17,15 +17,22 @@ class ITestDumper(ABC):
17
17
  @abstractmethod
18
18
  def dd(self, *args) -> None:
19
19
  """
20
- Dumps debugging information using the Debug class.
20
+ Outputs debugging information using the Debug class.
21
21
 
22
- This method captures the caller's file and line number,
23
- and uses the Debug class to output debugging information.
22
+ This method captures the caller's file and line number, then
23
+ utilizes the Debug class to display or log the provided arguments
24
+ for debugging purposes.
24
25
 
25
26
  Parameters
26
27
  ----------
27
28
  *args : tuple
28
- Variable length argument list to be dumped.
29
+ Variable length argument list containing the data to be dumped.
30
+
31
+ Returns
32
+ -------
33
+ None
34
+ This method does not return any value. Its purpose is to output
35
+ or log the debugging information.
29
36
  """
30
37
  pass
31
38
 
@@ -1,7 +1,5 @@
1
1
  from abc import ABC, abstractmethod
2
- from typing import Any
3
- from orionis.foundation.config.testing.entities.testing import Testing as Configuration
4
- from orionis.test.core.unit_test import UnitTest
2
+ from orionis.test.contracts.unit_test import IUnitTest
5
3
 
6
4
  class ITestKernel(ABC):
7
5
  """
@@ -19,116 +17,13 @@ class ITestKernel(ABC):
19
17
  """
20
18
 
21
19
  @abstractmethod
22
- def handle(
23
- self,
24
- config: Configuration = None,
25
- **kwargs: Any
26
- ) -> UnitTest:
20
+ def handle(self) -> IUnitTest:
27
21
  """
28
- Execute the complete test discovery and execution pipeline.
29
-
30
- This is the main entry point for running tests. Implementations must:
31
- 1. Validate the provided configuration
32
- 2. Discover test files based on configuration
33
- 3. Configure and execute the test suite
34
- 4. Return the test results
35
-
36
- Parameters
37
- ----------
38
- config : Configuration, optional
39
- A pre-configured Testing configuration instance. If None,
40
- implementations should create one from kwargs.
41
- **kwargs : Any
42
- Keyword arguments to create a Configuration instance if config is None.
43
- Common parameters include:
44
- - base_path : str, base directory for test discovery
45
- - folder_path : str or list, specific folders to search
46
- - pattern : str, file pattern for test discovery
47
- - verbosity : int, output verbosity level
48
- - execution_mode : str, test execution mode
49
- - max_workers : int, maximum number of worker threads
50
- - fail_fast : bool, stop on first failure
51
-
52
- Returns
53
- -------
54
- UnitTest
55
- The configured and executed test suite instance containing all results.
56
-
57
- Raises
58
- ------
59
- OrionisTestConfigException
60
- If the configuration validation fails.
61
- """
62
- pass
63
-
64
- @abstractmethod
65
- def handleCLI(
66
- self,
67
- sys_argv: list[str]
68
- ) -> UnitTest:
69
- """
70
- Process command line arguments for test execution.
71
-
72
- This method configures and runs tests based on command line arguments. It parses
73
- the provided sys_argv list into a TestArguments object, extracts configuration
74
- values, executes the tests, and handles output generation.
75
-
76
- Parameters
77
- ----------
78
- sys_argv : list[str]
79
- Command line arguments list including script name. The script name
80
- (first element) will be automatically removed before parsing.
22
+ Configure and execute the unit tests based on the current configuration.
81
23
 
82
24
  Returns
83
25
  -------
84
- UnitTest
85
- The test suite instance containing all test results.
86
-
87
- Raises
88
- ------
89
- OrionisTestConfigException
90
- If the provided sys_argv is not a valid list or if argument parsing fails.
91
-
92
- Notes
93
- -----
94
- The method supports various test execution options including parallel/sequential
95
- execution mode, fail fast behavior, result output configuration, and web reporting.
26
+ IUnitTest
27
+ The configured and executed unit test instance.
96
28
  """
97
29
  pass
98
-
99
- @abstractmethod
100
- def exit(
101
- self,
102
- code: int = 0
103
- ) -> None:
104
- """
105
- Terminate the test execution process and free associated resources.
106
-
107
- This method performs a clean shutdown of the test kernel by explicitly
108
- triggering garbage collection to release memory resources and then
109
- terminating the process with the provided exit code. It ensures that any
110
- remaining file handles, threads, or other resources are properly released.
111
-
112
- Parameters
113
- ----------
114
- code : int
115
- The exit code to return to the operating system. Should be 0 for
116
- successful execution or a non-zero value to indicate an error.
117
-
118
- Returns
119
- -------
120
- None
121
- This method does not return as it terminates the process.
122
-
123
- Raises
124
- ------
125
- ValueError
126
- If the provided code is not a valid integer or outside the allowed range.
127
-
128
- Notes
129
- -----
130
- Using os._exit() bypasses normal Python cleanup mechanisms and
131
- immediately terminates the process. This can be necessary when
132
- normal sys.exit() would be caught by exception handlers.
133
- """
134
- pass