orionis 0.373.0__py3-none-any.whl → 0.375.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.
@@ -1,10 +1,13 @@
1
1
  from typing import Any
2
- from orionis.container.container import Container
3
2
  from orionis.container.exceptions import OrionisContainerAttributeError, OrionisContainerException
3
+ from orionis.foundation.application import Application
4
+ from typing import TypeVar, Any
5
+
6
+ T = TypeVar('T')
4
7
 
5
8
  class FacadeMeta(type):
6
9
 
7
- def __getattr__(cls, name: str) -> Any:
10
+ def __getattr__(cls, name: str) -> T:
8
11
  """
9
12
  When an undefined attribute is accessed, this method resolves the service and delegates the call.
10
13
 
@@ -30,8 +33,8 @@ class FacadeMeta(type):
30
33
 
31
34
  class Facade(metaclass=FacadeMeta):
32
35
 
33
- # Container instance to resolve services
34
- _container = Container()
36
+ # Application instance to resolve services
37
+ _app = Application()
35
38
 
36
39
  @classmethod
37
40
  def getFacadeAccessor(cls) -> str:
@@ -79,13 +82,12 @@ class Facade(metaclass=FacadeMeta):
79
82
  service_name = cls.getFacadeAccessor()
80
83
 
81
84
  # Check if the service is bound in the container
82
- if not cls._container.bound(service_name):
85
+ if not cls._app.bound(service_name):
83
86
  raise OrionisContainerException(
84
87
  f"Service '{service_name}' not bound in the container. "
85
- f"Please ensure '{service_name}' is registered in the container before using the {cls.__name__} facade. "
86
- "You can register services in a service provider using the 'register' method."
88
+ f"Please ensure '{service_name}' is registered in the container before using the {cls.__name__} facade."
87
89
  )
88
90
 
89
91
  # Resolve the service instance from the container
90
- service_instance = cls._container.make(service_name, *args, **kwargs)
92
+ service_instance = cls._app.make(service_name, *args, **kwargs)
91
93
  return service_instance
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.373.0"
8
+ VERSION = "0.375.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -145,53 +145,43 @@ class TestArgumentParser(ITestArgumentParser):
145
145
 
146
146
  def parse(
147
147
  self,
148
- args=None
148
+ sys_argv: list[str]
149
149
  ) -> TestArguments:
150
150
  """
151
- Parse command line arguments and return TestArguments object.
151
+ Parse command line arguments from sys.argv and return TestArguments object.
152
152
 
153
153
  Parameters
154
154
  ----------
155
- args : list, optional
156
- List of arguments to parse. If None, uses sys.argv.
155
+ sys_argv : list[str]
156
+ Command line arguments including script name. The script name (first element)
157
+ will be automatically removed before parsing.
157
158
 
158
159
  Returns
159
160
  -------
160
161
  TestArguments
161
162
  Parsed test arguments object.
162
163
  """
163
- return self.parser.parse_args(args)
164
+ # Remove script name from sys.argv (first element)
165
+ args_only = sys_argv[1:] if len(sys_argv) > 0 else []
166
+
167
+ # Parse arguments and convert to TestArguments object
168
+ parsed_args = self.parser.parse_args(args_only)
169
+
170
+ # Create TestArguments instance from parsed arguments
171
+ return TestArguments(
172
+ verbosity=parsed_args.verbosity,
173
+ mode=parsed_args.mode,
174
+ fail_fast=parsed_args.fail_fast,
175
+ print_result=parsed_args.print_result,
176
+ throw_exception=parsed_args.throw_exception,
177
+ persistent=parsed_args.persistent,
178
+ persistent_driver=parsed_args.persistent_driver,
179
+ web_report=parsed_args.web_report,
180
+ print_output_buffer=parsed_args.print_output_buffer
181
+ )
164
182
 
165
183
  def help(
166
184
  self
167
185
  ) -> None:
168
186
  """Print help message for the test runner."""
169
- self.parser.print_help()
170
-
171
- def test_parser_init() -> TestArgumentParser:
172
- """
173
- Factory function to create a TestArgumentParser instance.
174
-
175
- Returns
176
- -------
177
- TestArgumentParser
178
- A new instance of the test argument parser.
179
- """
180
- return TestArgumentParser()
181
-
182
- def cli_test_args(args=None) -> TestArguments:
183
- """
184
- Convenience function to quickly parse test arguments.
185
-
186
- Parameters
187
- ----------
188
- args : list, optional
189
- List of arguments to parse. If None, uses sys.argv.
190
-
191
- Returns
192
- -------
193
- TestArguments
194
- Parsed test arguments object.
195
- """
196
- parser = test_parser_init()
197
- return parser.parse(args)
187
+ self.parser.print_help()
@@ -61,6 +61,41 @@ class ITestKernel(ABC):
61
61
  """
62
62
  pass
63
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.
81
+
82
+ Returns
83
+ -------
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.
96
+ """
97
+ pass
98
+
64
99
  @abstractmethod
65
100
  def exit(
66
101
  self,
@@ -12,20 +12,26 @@ class ITestArgumentParser(ABC):
12
12
  @abstractmethod
13
13
  def parse(
14
14
  self,
15
- args=None
15
+ sys_argv: list[str]
16
16
  ) -> TestArguments:
17
17
  """
18
18
  Parse command line arguments and return TestArguments object.
19
19
 
20
20
  Parameters
21
21
  ----------
22
- args : list, optional
23
- List of arguments to parse. If None, uses sys.argv.
22
+ sys_argv : list[str]
23
+ Command line arguments including script name. The script name (first element)
24
+ will be automatically removed before parsing.
24
25
 
25
26
  Returns
26
27
  -------
27
28
  TestArguments
28
- Parsed test arguments object.
29
+ Parsed test arguments object containing all configuration options for test execution.
30
+
31
+ Raises
32
+ ------
33
+ SystemExit
34
+ If argument parsing fails or help is requested.
29
35
  """
30
36
  pass
31
37
 
orionis/test/kernel.py CHANGED
@@ -5,7 +5,10 @@ from os import walk
5
5
  from orionis.foundation.config.testing.entities.testing import Testing as Configuration
6
6
  from orionis.foundation.contracts.application import IApplication
7
7
  from orionis.test.contracts.kernel import ITestKernel
8
+ from orionis.test.arguments.parser import TestArgumentParser
8
9
  from orionis.test.core.unit_test import UnitTest
10
+ from orionis.test.entities.arguments import TestArguments
11
+ from orionis.test.enums.execution_mode import ExecutionMode
9
12
  from orionis.test.exceptions import OrionisTestConfigException
10
13
 
11
14
  class TestKernel(ITestKernel):
@@ -227,6 +230,63 @@ class TestKernel(ITestKernel):
227
230
  # Return the test suite instance containing all results
228
231
  return tests
229
232
 
233
+ def handleCLI(
234
+ self,
235
+ sys_argv: list[str],
236
+ ) -> UnitTest:
237
+
238
+ """
239
+ Process command line arguments for test execution.
240
+ This method configures and runs tests based on command line arguments. It extracts
241
+ configuration from the provided TestArguments object, executes the tests, and
242
+ handles output generation.
243
+ Parameters
244
+ ----------
245
+ args : TestArguments
246
+ Command line arguments parsed into a TestArguments object.
247
+ base_path : str, optional
248
+ Base directory to search for test files, by default 'tests'.
249
+ folder_path : str, optional
250
+ Pattern for folder selection within base_path, by default '*'.
251
+ pattern : str, optional
252
+ Filename pattern for test files, by default 'test_*.py'.
253
+ Returns
254
+ -------
255
+ UnitTest
256
+ The test suite instance containing all test results.
257
+ Notes
258
+ -----
259
+ The method supports various test execution options including parallel/sequential
260
+ execution mode, fail fast behavior, and result output configuration.
261
+ """
262
+
263
+ # Validate the provided arguments
264
+ if not isinstance(sys_argv, list):
265
+ raise OrionisTestConfigException("The provided sys_argv must be a list of command line arguments.")
266
+
267
+ # Assign the provided arguments to a TestArguments instance
268
+ parser = TestArgumentParser()
269
+ args:TestArguments = parser.parse(sys_argv)
270
+
271
+ # Extract and validate the configuration from command line arguments
272
+ test = self.handle(
273
+ verbosity = int(args.verbosity),
274
+ execution_mode = ExecutionMode.PARALLEL if args.mode == 'parallel' else ExecutionMode.SEQUENTIAL,
275
+ fail_fast = bool(args.fail_fast),
276
+ print_result = bool(args.print_result),
277
+ throw_exception = bool(args.throw_exception),
278
+ persistent = bool(args.persistent),
279
+ persistent_driver = str(args.persistent_driver) if args.persistent_driver else None,
280
+ web_report = bool(args.web_report)
281
+ )
282
+
283
+ # If requested, print the output buffer
284
+ if args.print_output_buffer:
285
+ test.printOutputBuffer()
286
+
287
+ # Return the test suite instance containing all results
288
+ return test
289
+
230
290
  def exit(
231
291
  self,
232
292
  code: int = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.373.0
3
+ Version: 0.375.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -130,7 +130,7 @@ orionis/container/exceptions/exception.py,sha256=goTDEwC70xTMD2qppN8KV-xyR0Nps21
130
130
  orionis/container/exceptions/type.py,sha256=cYuvoXVOgRYj3tZPfK341aUERkf33-buOiI2eXxcrAw,470
131
131
  orionis/container/exceptions/value.py,sha256=hjY0YEusoL3DurME1ornxvIv1wyGaf6tBggLFlGHblo,472
132
132
  orionis/container/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
133
- orionis/container/facades/facade.py,sha256=22AMMDEqfUCIj2EsGTnjTKLsnLq3QhhqpV6mp4gfRzw,3229
133
+ orionis/container/facades/facade.py,sha256=gVbZHu200hJleoQOTJ2NPBIwBL4TDxFTLDnQ_I2Jabs,3174
134
134
  orionis/container/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
135
135
  orionis/container/providers/service_provider.py,sha256=9SHDzeuJbktRhrLq0zo2fZhRR4xOaYGOb2wKl7iBR4k,1923
136
136
  orionis/container/resolver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -247,7 +247,7 @@ orionis/foundation/providers/path_resolver_provider.py,sha256=rXvaVc5sSqmDgRzWJo
247
247
  orionis/foundation/providers/progress_bar_provider.py,sha256=75Jr4iEgUOUGl8Di1DioeP5_HRQlR-1lVzPmS96sWjA,737
248
248
  orionis/foundation/providers/workers_provider.py,sha256=WWlji3C69_-Y0c42aZDbR_bmcE_qZEh2SaA_cNkCivI,702
249
249
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
250
- orionis/metadata/framework.py,sha256=n5P3VhS-24TttbJMjYiIuwCDr1uNzEs6BpL9YY3KjPo,4960
250
+ orionis/metadata/framework.py,sha256=T4e47ookmv_Ntqnd3lyK90OVvW2FPok9ixkarBE6dec,4960
251
251
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
252
252
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
253
253
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -349,17 +349,17 @@ orionis/support/standard/exceptions/value.py,sha256=7xry_TZz3k-BLAZTR_uDiQ0RfXOk
349
349
  orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
350
350
  orionis/support/wrapper/dot_dict.py,sha256=VdAUH-DO6y86pl_9N6v-vU9mdLraWh5HjVzI5iC1dMs,5295
351
351
  orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
352
- orionis/test/kernel.py,sha256=eFBuctFaeRNXuK7MbWMIOs0Wsw2Kdi9yHaImkQJc2O4,10771
352
+ orionis/test/kernel.py,sha256=_dzms3-5IuDNIE_JjaexwaoZhkHNvU-aAUEwOVtW8sc,13337
353
353
  orionis/test/arguments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
354
- orionis/test/arguments/parser.py,sha256=tbTouQ0X2Q_RKbYixzbj_eiEu5d5CcsrzJ4EU3IY0Xk,5810
354
+ orionis/test/arguments/parser.py,sha256=Oz09NCbQ9JrJgviiPJ92WbRa54rXWCsr6RDzPoh05vE,6019
355
355
  orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
356
356
  orionis/test/cases/asynchronous.py,sha256=0nOSpl8jMFZ7sshbL0pLZ5QSnhjn4cAK2ndDWzBdNik,4687
357
357
  orionis/test/cases/synchronous.py,sha256=8KOQnby7Zm_w_zxhcqroMQWt5KblbLgpI3rvKE3v-8w,3762
358
358
  orionis/test/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
359
  orionis/test/contracts/dumper.py,sha256=5OqGc4GEXCXX76sCX185giQMyKwwZvlOv3I7tTwV2fQ,1324
360
- orionis/test/contracts/kernel.py,sha256=anUHpXZ5XDZs_vfHGDNv1nQpxD8iyQd2Eru7YdoDnVU,3593
360
+ orionis/test/contracts/kernel.py,sha256=j4vx4KRhDrRI7hF95Scfpbso7-ltWPtvQOIFu9X-1Vs,4768
361
361
  orionis/test/contracts/logs.py,sha256=uqnTfq1TsaD31t0gc4WjHJP5wJXWFosRX6yqZ1HcBBQ,4409
362
- orionis/test/contracts/parser.py,sha256=Yn3vB3mZzv5A61fJe4bM8mUZnBSTLY4Qmjkm28SDJHc,975
362
+ orionis/test/contracts/parser.py,sha256=njz9OJShDqw85mNdLSH4un9JQZC3qbtrKGKzApwrQJs,1240
363
363
  orionis/test/contracts/printer.py,sha256=FcTii6uglVIfvsgbmG0lj3hv1RGmDWuDo0eo4Z8rMbQ,6014
364
364
  orionis/test/contracts/render.py,sha256=0o6NjrKx2ewBf1JvAf8BaAtJQPb64yq1FJCeKb3iXys,967
365
365
  orionis/test/contracts/unit_test.py,sha256=pEceAVTJGb1ohEiiMD8X3YKT6xUsRECpB0ZO9K-RUWU,8383
@@ -385,10 +385,10 @@ orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
385
385
  orionis/test/records/logs.py,sha256=EOQcloMVdhlNl2lU9igQz8H4b-OtKtiwh2pgr_QZWOI,13186
386
386
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
387
387
  orionis/test/view/render.py,sha256=zd7xDvVfmQ2HxZamDTzL2-z2PpyL99EaolbbM7wTah4,5014
388
- orionis-0.373.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
388
+ orionis-0.375.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
389
389
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
390
390
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
391
- tests/example/test_example.py,sha256=enE3spBo1Eue1nfKicIW4Za0u2CIvgQGKcn2K4QBnDU,693
391
+ tests/example/test_example.py,sha256=4-L590gApSEEXj-cN2lhUDbija7EFTe1o1BKZcTv4XM,674
392
392
  tests/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
393
393
  tests/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
394
394
  tests/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -486,8 +486,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=nTNrvJkMSPx_aopEQ9
486
486
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
487
487
  tests/testing/test_testing_result.py,sha256=fnH7hjumNSErAFGITJgq2LHxSzvPF2tdtmHL9kyAv-Y,4409
488
488
  tests/testing/test_testing_unit.py,sha256=d3CRGo6608fMzYcZKIKapjx_af2aigqWiKSiuK9euIY,7600
489
- orionis-0.373.0.dist-info/METADATA,sha256=m_b-wSvwskKTXgGTuNaNvbYHfIaN_QXBjV_IULpfbkU,4772
490
- orionis-0.373.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
491
- orionis-0.373.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
492
- orionis-0.373.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
493
- orionis-0.373.0.dist-info/RECORD,,
489
+ orionis-0.375.0.dist-info/METADATA,sha256=e5WcE68cl9y_lc2Kx-tPV7k4qhaZ-3z-SUJSpO1akmI,4772
490
+ orionis-0.375.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
491
+ orionis-0.375.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
492
+ orionis-0.375.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
493
+ orionis-0.375.0.dist-info/RECORD,,
@@ -6,7 +6,7 @@ class TestExample(SyncTestCase):
6
6
  Unit tests for basic example functionality.
7
7
  """
8
8
 
9
- def testUnitExample(self, console: IConsole):
9
+ def testUnitExample(self):
10
10
  """
11
11
  Test that basic equality assertions work as expected.
12
12