orionis 0.444.0__py3-none-any.whl → 0.446.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.
@@ -174,7 +174,6 @@ class Application(Container, IApplication):
174
174
  # Import core framework providers
175
175
  from orionis.foundation.providers.console_provider import ConsoleProvider
176
176
  from orionis.foundation.providers.dumper_provider import DumperProvider
177
- from orionis.foundation.providers.path_resolver_provider import PathResolverProvider
178
177
  from orionis.foundation.providers.progress_bar_provider import ProgressBarProvider
179
178
  from orionis.foundation.providers.workers_provider import WorkersProvider
180
179
  from orionis.foundation.providers.testing_provider import TestingProvider
@@ -183,7 +182,6 @@ class Application(Container, IApplication):
183
182
  core_providers = [
184
183
  ConsoleProvider,
185
184
  DumperProvider,
186
- PathResolverProvider,
187
185
  ProgressBarProvider,
188
186
  WorkersProvider,
189
187
  LoggerProvider,
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.444.0"
8
+ VERSION = "0.446.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -21,30 +21,10 @@ from orionis.test.contracts.test_result import IOrionisTestResult
21
21
  from orionis.test.contracts.unit_test import IUnitTest
22
22
  from orionis.test.entities.result import TestResult
23
23
  from orionis.test.enums import TestStatus
24
- from orionis.test.exceptions import (
25
- OrionisTestFailureException,
26
- OrionisTestPersistenceError,
27
- OrionisTestValueError,
28
- )
24
+ from orionis.test.exceptions import *
29
25
  from orionis.test.output.printer import TestPrinter
30
26
  from orionis.test.records.logs import TestLogs
31
- from orionis.test.validators import (
32
- ValidExecutionMode,
33
- ValidFailFast,
34
- ValidPersistent,
35
- ValidPersistentDriver,
36
- ValidPrintResult,
37
- ValidThrowException,
38
- ValidVerbosity,
39
- ValidWebReport,
40
- ValidWorkers,
41
- ValidBasePath,
42
- ValidFolderPath,
43
- ValidNamePattern,
44
- ValidPattern,
45
- ValidTags,
46
- ValidModuleName,
47
- )
27
+ from orionis.test.validators import *
48
28
  from orionis.test.view.render import TestingResultRender
49
29
 
50
30
  class UnitTest(IUnitTest):
@@ -54,53 +34,6 @@ class UnitTest(IUnitTest):
54
34
  Advanced unit testing manager for the Orionis framework.
55
35
 
56
36
  This class provides mechanisms for discovering, executing, and reporting unit tests with extensive configurability. It supports sequential and parallel execution, test filtering by name or tags, and detailed result tracking including execution times, error messages, and tracebacks.
57
-
58
- Attributes
59
- ----------
60
- __app : Optional[IApplication]
61
- Application instance for dependency injection.
62
- __verbosity : Optional[int]
63
- Verbosity level for test output.
64
- __execution_mode : Optional[str]
65
- Execution mode for tests ('SEQUENTIAL' or 'PARALLEL').
66
- __max_workers : Optional[int]
67
- Maximum number of workers for parallel execution.
68
- __fail_fast : Optional[bool]
69
- Whether to stop on first failure.
70
- __throw_exception : Optional[bool]
71
- Whether to raise exceptions on test failures.
72
- __persistent : Optional[bool]
73
- Whether to persist test results.
74
- __persistent_driver : Optional[str]
75
- Persistence driver ('sqlite' or 'json').
76
- __web_report : Optional[bool]
77
- Whether to generate a web report.
78
- __folder_path : Optional[str]
79
- Folder path for test discovery.
80
- __base_path : Optional[str]
81
- Base directory for test discovery.
82
- __pattern : Optional[str]
83
- File name pattern for test discovery.
84
- __test_name_pattern : Optional[str]
85
- Pattern for filtering test names.
86
- __tags : Optional[List[str]]
87
- Tags for filtering tests.
88
- __module_name : Optional[str]
89
- Module name for test discovery.
90
- __loader : unittest.TestLoader
91
- Loader for discovering tests.
92
- __suite : unittest.TestSuite
93
- Test suite containing discovered tests.
94
- __discovered_tests : List
95
- List of discovered test metadata.
96
- __printer : Optional[TestPrinter]
97
- Utility for printing test results.
98
- __output_buffer : Optional[str]
99
- Buffer for capturing standard output.
100
- __error_buffer : Optional[str]
101
- Buffer for capturing error output.
102
- __result : Optional[dict]
103
- Result summary of the test execution.
104
37
  """
105
38
 
106
39
  def __init__(
@@ -117,6 +50,7 @@ class UnitTest(IUnitTest):
117
50
  -------
118
51
  None
119
52
  """
53
+
120
54
  # Application instance for dependency injection
121
55
  self.__app: Optional[IApplication] = app or Orionis()
122
56
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.444.0
3
+ Version: 0.446.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
@@ -68,7 +68,7 @@ orionis/container/validators/is_subclass.py,sha256=4sBaGLoRs8nUhuWjlP0VJqyTwVHYq
68
68
  orionis/container/validators/is_valid_alias.py,sha256=4uAYcq8xov7jZbXnpKpjNkxcZtlTNnL5RRctVPMwJes,1424
69
69
  orionis/container/validators/lifetime.py,sha256=IQ43fDNrxYHMlZH2zlYDJnlkLO_eS4U7Fs3UJgQBidI,1844
70
70
  orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
- orionis/foundation/application.py,sha256=w_7ZNdcrL4u9a0eqQOAMiLxbnfB7ydNGFgh6xNnCVYA,76782
71
+ orionis/foundation/application.py,sha256=ErkfS6AlC817vBmVDbx_UVYmkaABuEqZCBCrkDGNmzo,76653
72
72
  orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  orionis/foundation/config/startup.py,sha256=vbzduprRCNyYeR2nnMaqc1uKXw6PTzAY2jVfXNQKN8I,9691
74
74
  orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -174,12 +174,11 @@ orionis/foundation/providers/console_provider.py,sha256=wsv0RjoYU9MatC1ZRBAtV9iC
174
174
  orionis/foundation/providers/dumper_provider.py,sha256=d0k9yKVfwf40W4If0_rF09odLDXFA1w9jxU1MvZvCbo,1498
175
175
  orionis/foundation/providers/inspirational_provider.py,sha256=ZIsuEq2Sif7C1b1hYC7_mEBd0kGwd8KWd-fHyyd6Qs4,2298
176
176
  orionis/foundation/providers/logger_provider.py,sha256=PvwMxP5TKmn9DP8H8nJfyr16XgiJaGHyxPSMOpFgv84,1448
177
- orionis/foundation/providers/path_resolver_provider.py,sha256=s44Mg68RsUNPlilQlXMBE7onVexa7kyDmVQmci1JL4g,1342
178
177
  orionis/foundation/providers/progress_bar_provider.py,sha256=P__zpCyC29WCwErYGbh5dgcMRxw3XYmHzaUkzms9vPM,1345
179
178
  orionis/foundation/providers/testing_provider.py,sha256=fSZfwKnScTxGlGrcEPReGIiOPs8XkoEaNNARN1wC6LU,2939
180
179
  orionis/foundation/providers/workers_provider.py,sha256=YMRLdq_YQnR1unnoYvDpYQZbLli04f0CckuR6Q--wKg,1379
181
180
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
182
- orionis/metadata/framework.py,sha256=Que9Q_spu-gld9CNZt90yTGnUPDQBWf87yrjBiveqPQ,4088
181
+ orionis/metadata/framework.py,sha256=cmZ_JrSV8hHiQ6tIZr04kISqOKd-MrIiXmwLgvU-2EE,4088
183
182
  orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
184
183
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
185
184
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -260,13 +259,6 @@ orionis/services/log/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
260
259
  orionis/services/log/handlers/filename.py,sha256=XKkq4Gq7N2m8F3xtyUIevTQLMaYSLJ3wC04Irs45VcE,2481
261
260
  orionis/services/log/handlers/size_rotating.py,sha256=SLg7r-XW1NWyVxN8wJxeI8jhypzdXw_jq2zg5uy3iaQ,1131
262
261
  orionis/services/log/handlers/timed_rotating.py,sha256=UJicPwHcIVl2FPRPjuiKwH3-zuiPG1YV7UYLLMPm4To,1128
263
- orionis/services/paths/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
264
- orionis/services/paths/resolver.py,sha256=6XPQ4D2P-8teg_lJAC4Ju_bAxbkb5rjoR3D-CaNmYAQ,3097
265
- orionis/services/paths/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
266
- orionis/services/paths/contracts/resolver.py,sha256=3RFi2mlwqSwknYvZCnyKVcTIUEhb7k21oTs9gSP3m3U,1144
267
- orionis/services/paths/exceptions/__init__.py,sha256=r5b4D4XWNK07zLtqaXBk_PNYszScqbp_8kUN37cOk4E,184
268
- orionis/services/paths/exceptions/exception.py,sha256=cK-TbUT02X2lvbAP4yFdfHx4S45wBOcYl3_tiWd67UM,472
269
- orionis/services/paths/exceptions/file.py,sha256=bsK0QoXwRFyDeHvITxwmgaBuwiO2eoRUhRzNizmX1No,475
270
262
  orionis/services/system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
271
263
  orionis/services/system/imports.py,sha256=aSXG9879ur91d6OsqV2DUYWmmwbwFHX8CHb99cPfFcU,7057
272
264
  orionis/services/system/workers.py,sha256=EfGxU_w42xRnZ1yslsui3wVG8pfe__V3GYGEIyo8JxQ,3144
@@ -283,7 +275,6 @@ orionis/support/facades/console.py,sha256=OvxQ-r8PsPocJTaIUftmJnnr4SuONHQWYFz2_r
283
275
  orionis/support/facades/dumper.py,sha256=XAHJTXrMjPchGQMIAU0hlcUjMZQK_ogrE0voRm2HdI8,434
284
276
  orionis/support/facades/inspire.py,sha256=m2UbKXyggxASd0HTRT5M-mJ0FvMP_NIJ0lW8HTQMi4M,759
285
277
  orionis/support/facades/logger.py,sha256=2EbSbJDSyKFUQmZUpoMsc5704Mzj2Skehx_9UpDluhc,450
286
- orionis/support/facades/path_resolver.py,sha256=lRLbu69i8PzM-I53gzXroHIurxzyFdssNWOYMjPgqco,442
287
278
  orionis/support/facades/progress_bar.py,sha256=NOCwAV873GptedgySMZpM_A_DoM-UQrMg2kDHpS6zi8,423
288
279
  orionis/support/facades/testing.py,sha256=FJy7bnDiNHMe7jutARELHom6umDxlLVMMOj6aLm0Vak,490
289
280
  orionis/support/facades/workers.py,sha256=DJ_mSnD4budFBrPGf-epVYrSQ1AzDcJ82db0QmNTAyU,479
@@ -318,7 +309,7 @@ orionis/test/contracts/render.py,sha256=wpDQzUtT0r8KFZ7zPcxWHXQ1EVNKxzA_rZ6ZKUcZ
318
309
  orionis/test/contracts/test_result.py,sha256=SNXJ2UerkweYn7uCT0i0HmMGP0XBrL_9KJs-0ZvIYU4,4002
319
310
  orionis/test/contracts/unit_test.py,sha256=PSnjEyM-QGQ3Pm0ZOqaa8QdPOtilGBVO4R87JYdVa-8,5386
320
311
  orionis/test/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
321
- orionis/test/core/unit_test.py,sha256=IIpPLM4pXZKCpKAZ-0PPatGuWjBXxgjKQxB8IJLB1zY,63310
312
+ orionis/test/core/unit_test.py,sha256=7oHQiWfMMFQ3rsuKHBRS34Aqbk5nTinsGVh44OAkHE0,61051
322
313
  orionis/test/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
323
314
  orionis/test/entities/result.py,sha256=IMAd1AiwOf2z8krTDBFMpQe_1PG4YJ5Z0qpbr9xZwjg,4507
324
315
  orionis/test/enums/__init__.py,sha256=M3imAgMvKFTKg55FbtVoY3zxj7QRY9AfaUWxiSZVvn4,66
@@ -352,7 +343,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
352
343
  orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
353
344
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
354
345
  orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
355
- orionis-0.444.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
346
+ orionis-0.446.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
356
347
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
357
348
  tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
358
349
  tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -386,7 +377,7 @@ tests/container/validators/test_is_subclass.py,sha256=0Uc8uIR69ZX7G5Nrex0LMQXrue
386
377
  tests/container/validators/test_is_valid_alias.py,sha256=NA9QbIEh7n2_0GeVTMCppZG4_3ya4QrcvGI_lw1iJA8,5658
387
378
  tests/container/validators/test_lifetime.py,sha256=5PequjXAcIcp0Q4TIki7THSU31XftGpI0u1mVGqHmpU,4692
388
379
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
389
- tests/example/test_example.py,sha256=XJEcsro3vCO5m4zvMiWUGphvd0C7oIkBtUfQgTDsdUU,25568
380
+ tests/example/test_example.py,sha256=W6lA0_uV6bNm7JZ39rHZn30LHkdq_ddrUO6T1K2raZ4,27104
390
381
  tests/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
391
382
  tests/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
392
383
  tests/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -464,8 +455,6 @@ tests/services/introspection/reflection/mock/__init__.py,sha256=47DEQpj8HBSa-_TI
464
455
  tests/services/introspection/reflection/mock/fake_reflect_instance.py,sha256=iMf_yKgk0Y91XUHhRcl2qw7Z83QeNspvLi_tl4Dp-rI,28032
465
456
  tests/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
466
457
  tests/services/log/test_log.py,sha256=fCI2gX9-YN1z-xPMwIlggUFHeBlqfUajQoyQu4dmao0,2868
467
- tests/services/path/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
468
- tests/services/path/test_services_resolver.py,sha256=aWSSFgV_D10t3llUeCWEBB1mF3dWrZbFn5XbJy2sQME,3903
469
458
  tests/services/system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
470
459
  tests/services/system/test_services_system_imports.py,sha256=jbtIQkw_4DI6x2E-4Lg3evnLAgCgDIBWE63LdJTLkxc,7507
471
460
  tests/services/system/test_services_system_workers.py,sha256=wITbpJHKW_OXqTaFeteNRFuw5Q3_7d9lWNJnFE2r6to,5052
@@ -498,8 +487,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
498
487
  tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
499
488
  tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
500
489
  tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
501
- orionis-0.444.0.dist-info/METADATA,sha256=YgxccCDNizNHssu-14sVeL6dVMvkTMfvdfd3UcB1SeY,4772
502
- orionis-0.444.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
503
- orionis-0.444.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
504
- orionis-0.444.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
505
- orionis-0.444.0.dist-info/RECORD,,
490
+ orionis-0.446.0.dist-info/METADATA,sha256=iD7rp-OlLM2n4AjNDNrcjTyKFl70G_gD165H4065uXo,4772
491
+ orionis-0.446.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
492
+ orionis-0.446.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
493
+ orionis-0.446.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
494
+ orionis-0.446.0.dist-info/RECORD,,
@@ -1,42 +1,8 @@
1
- """
2
- Orionis Framework Test Examples
3
- ===============================
4
-
5
- This module contains comprehensive test examples demonstrating the capabilities
6
- of the Orionis testing framework, including both synchronous and asynchronous
7
- testing patterns with dependency injection.
8
-
9
- Examples:
10
- --------
11
- Run synchronous tests:
12
- >>> from tests.example.test_example import TestSynchronousExample
13
- >>> test = TestSynchronousExample()
14
- >>> test.setUp()
15
- >>> test.testBasicAssertions()
16
-
17
- Run asynchronous tests:
18
- >>> from tests.example.test_example import TestAsynchronousExample
19
- >>> test = TestAsynchronousExample()
20
- >>> await test.asyncSetUp()
21
- >>> await test.testAsyncBasicOperations()
22
-
23
- Notes:
24
- -----
25
- These examples showcase:
26
- - Dependency injection patterns
27
- - Path resolution services
28
- - Container integration
29
- - Error handling strategies
30
- - Data validation techniques
31
- - Concurrent operations
32
- - Async/await patterns
33
- """
34
-
35
1
  import asyncio
36
2
  import time
37
3
  from typing import Dict, List, Any
38
4
  from orionis.foundation.application import Application
39
- from orionis.services.paths.contracts.resolver import IResolver
5
+ from orionis.services.system.contracts.workers import IWorkers
40
6
  from orionis.test.cases.asynchronous import AsyncTestCase
41
7
  from orionis.test.cases.synchronous import SyncTestCase
42
8
 
@@ -48,44 +14,6 @@ class TestSynchronousExample(SyncTestCase):
48
14
  path resolution, container usage, and error handling in a synchronous context.
49
15
  The tests demonstrate best practices for writing maintainable and reliable
50
16
  test cases within the Orionis framework.
51
-
52
- Attributes
53
- ----------
54
- test_data : Dict[str, Any]
55
- Test data dictionary containing sample files and expected values
56
- for use across multiple test methods.
57
-
58
- Methods
59
- -------
60
- setUp()
61
- Initialize test environment before each test method execution.
62
- tearDown()
63
- Clean up resources after each test method completion.
64
- testBasicAssertions()
65
- Validate basic assertion functionality and patterns.
66
- testPathResolution(paths)
67
- Test path resolution service functionality with dependency injection.
68
- testContainerIntegration(container)
69
- Validate container dependency injection capabilities.
70
- testErrorHandling()
71
- Test error handling and exception management patterns.
72
- testDataValidation()
73
- Validate data validation and complex assertion patterns.
74
-
75
- Examples
76
- --------
77
- Basic usage:
78
- >>> test = TestSynchronousExample()
79
- >>> test.setUp()
80
- >>> test.testBasicAssertions()
81
- >>> test.tearDown()
82
-
83
- With dependency injection:
84
- >>> test = TestSynchronousExample()
85
- >>> test.setUp()
86
- >>> # Path resolver will be injected automatically
87
- >>> test.testPathResolution(resolver_instance)
88
- >>> test.tearDown()
89
17
  """
90
18
 
91
19
  def setUp(self) -> None:
@@ -156,90 +84,112 @@ class TestSynchronousExample(SyncTestCase):
156
84
  "Unexpected value found in container"
157
85
  )
158
86
 
159
- def testPathResolution(self, paths: IResolver) -> None:
87
+ def testMaxWorkers(self, worker: IWorkers) -> None:
160
88
  """
161
- Test path resolution service functionality with dependency injection.
89
+ Test worker service functionality with dependency injection.
162
90
 
163
- Validates the path resolution service by testing relative path creation
164
- and string conversion operations. This method demonstrates how dependency
165
- injection works within the Orionis testing framework.
91
+ Validates the worker service's ability to calculate the maximum number
92
+ of available workers in the system. This method demonstrates dependency
93
+ injection capabilities with the IWorkers service and ensures proper
94
+ worker count calculation functionality.
166
95
 
167
96
  Parameters
168
97
  ----------
169
- paths : IResolver
170
- Injected path resolver service instance for testing path operations.
171
- This parameter is automatically injected by the testing framework
172
- based on the type annotation.
98
+ worker : IWorkers
99
+ Injected worker service instance for testing worker calculation
100
+ capabilities. The service provides methods for determining optimal
101
+ worker counts based on system resources.
102
+
103
+ Returns
104
+ -------
105
+ None
106
+ This test method does not return any value. It performs assertions
107
+ to validate the worker service functionality.
173
108
 
174
109
  Tests
175
110
  -----
176
- - Relative path creation from string path
177
- - Path string conversion and format validation
178
- - Path ending validation
179
- - Path content validation
111
+ - Worker service instance validation
112
+ - Worker count calculation functionality
113
+ - Worker count positive value validation
114
+ - Service method execution through dependency injection
180
115
 
181
116
  Raises
182
117
  ------
183
118
  AssertionError
184
- If path resolution fails or returns unexpected results.
119
+ If worker count calculation fails, returns invalid values, or
120
+ the calculated worker count is not greater than zero.
185
121
  """
186
- # Test relative path resolution
187
- relative_path = paths.relativePath(self.test_data["sample_file"])
188
- path_string = relative_path.toString()
189
122
 
190
- # Verify path resolution results
191
- self.assertTrue(
192
- path_string.endswith("test_example.py"),
193
- "Path should end with test_example.py"
194
- )
195
- self.assertIn(
196
- "test_example.py",
197
- path_string,
198
- "Path should contain expected directory structure"
123
+ # Calculate maximum available workers using the injected service
124
+ max_workers = worker.calculate()
125
+
126
+ # Validate that worker count is greater than zero
127
+ self.assertGreater(
128
+ max_workers,
129
+ 0,
130
+ "Worker count should be greater than zero"
199
131
  )
200
132
 
201
133
  def testContainerIntegration(self, container: Application) -> None:
202
134
  """
203
135
  Test container dependency injection functionality.
204
136
 
205
- Validates the container's ability to resolve services and manage
206
- dependencies. This method demonstrates the dependency injection
207
- capabilities of the Orionis application container.
137
+ Validates the application container's ability to resolve services and manage
138
+ dependencies correctly. This method demonstrates the dependency injection
139
+ capabilities of the Orionis application container, including service
140
+ registration, resolution, and lifecycle management. The test ensures that
141
+ the container can successfully instantiate and provide service instances
142
+ when requested through the dependency injection mechanism.
208
143
 
209
144
  Parameters
210
145
  ----------
211
146
  container : Application
212
147
  Injected application container instance for testing dependency
213
- injection capabilities. The container manages service resolution
214
- and dependency lifecycle.
148
+ injection capabilities. The container manages service resolution,
149
+ dependency lifecycle, and provides access to registered services
150
+ throughout the application.
151
+
152
+ Returns
153
+ -------
154
+ None
155
+ This test method does not return any value. It performs assertions
156
+ to validate the container's dependency injection functionality.
215
157
 
216
158
  Tests
217
159
  -----
218
- - Container instance validation
219
- - Service resolution from container
220
- - Service functionality validation through container
221
- - Dependency lifecycle management
160
+ - Container instance validation and null checking
161
+ - Service resolution from container using interface contracts
162
+ - Service functionality validation through container-resolved instances
163
+ - Dependency lifecycle management and proper instantiation
164
+ - Interface-to-implementation mapping verification
222
165
 
223
166
  Raises
224
167
  ------
225
168
  AssertionError
226
- If container operations fail or services cannot be resolved.
169
+ If container operations fail, services cannot be resolved, or
170
+ the container instance is invalid or None.
171
+
172
+ Notes
173
+ -----
174
+ This test validates the core dependency injection functionality that
175
+ is essential for the Orionis framework's service architecture. The
176
+ container must be able to resolve services using their interface
177
+ contracts and provide properly configured instances.
227
178
  """
228
- # Test container instance validation
179
+
180
+ # Validate that the injected container instance is not None
181
+ # This ensures the dependency injection framework is working correctly
229
182
  self.assertIsNotNone(container, "Container instance should not be None")
230
183
 
231
- # Test service resolution from container
232
- path_resolver: IResolver = container.make(IResolver)
233
- self.assertIsNotNone(
234
- path_resolver,
235
- "Service resolution should return valid instance"
236
- )
184
+ # Attempt to resolve the IWorkers service from the container
185
+ # This tests the container's ability to map interfaces to implementations
186
+ workers: IWorkers = container.make(IWorkers)
237
187
 
238
- # Test service functionality through container
239
- test_path = path_resolver.relativePath("README.md")
188
+ # Verify that the service resolution was successful
189
+ # The container should return a valid instance implementing IWorkers
240
190
  self.assertIsNotNone(
241
- test_path,
242
- "Service method execution should return valid result"
191
+ workers,
192
+ "Service resolution should return valid instance"
243
193
  )
244
194
 
245
195
  def testErrorHandling(self) -> None:
@@ -436,54 +386,50 @@ class TestAsynchronousExample(AsyncTestCase):
436
386
  "Async sleep duration should not exceed maximum time tolerance"
437
387
  )
438
388
 
439
- async def testAsyncPathResolution(self, paths: IResolver) -> None:
389
+ async def testAsyncMaxWorkers(self, worker: IWorkers) -> None:
440
390
  """
441
- Test async path resolution service functionality with dependency injection.
391
+ Test async worker service functionality with dependency injection.
442
392
 
443
- Validates async path resolution operations by simulating async I/O
444
- operations and testing path resolution in an asynchronous context.
393
+ Validates async worker operations by simulating async I/O
394
+ operations and testing worker calculation in an asynchronous context.
445
395
  This method demonstrates async dependency injection patterns.
446
396
 
447
397
  Parameters
448
398
  ----------
449
- paths : IResolver
450
- Injected path resolver service instance for async path operations.
399
+ worker : IWorkers
400
+ Injected worker service instance for async worker operations.
451
401
  This parameter is automatically injected by the async testing framework.
452
402
 
453
403
  Tests
454
404
  -----
455
- - Async path resolution with simulated I/O delay
456
- - Path string conversion in async context
457
- - Path validation in async operations
405
+ - Async worker calculation with simulated I/O delay
406
+ - Worker count validation in async context
407
+ - Worker validation in async operations
458
408
  - Async service method execution
459
409
 
460
410
  Raises
461
411
  ------
462
412
  AssertionError
463
- If async path resolution fails or returns unexpected results.
413
+ If async worker calculation fails or returns unexpected results.
464
414
  """
465
- async def resolve_path_async(path_name: str) -> str:
415
+ async def calculate_workers_async() -> int:
466
416
  """
467
- Simulate async path resolution with I/O delay.
468
-
469
- Parameters
470
- ----------
471
- path_name : str
472
- Path name to resolve asynchronously.
417
+ Simulate async worker calculation with I/O delay.
473
418
 
474
419
  Returns
475
420
  -------
476
- str
477
- Resolved path as string.
421
+ int
422
+ Calculated maximum workers count.
478
423
  """
479
424
  await asyncio.sleep(0.01) # Simulate async I/O operation
480
- return paths.relativePath(path_name).toString()
481
-
482
- # Test async path resolution
483
- resolved_path = await resolve_path_async("tests/example/test_example.py")
484
- self.assertTrue(
485
- resolved_path.endswith("test_example.py"),
486
- "Async path resolution should return correct file ending"
425
+ return worker.calculate()
426
+
427
+ # Test async worker calculation
428
+ max_workers = await calculate_workers_async()
429
+ self.assertGreater(
430
+ max_workers,
431
+ 0,
432
+ "Async worker calculation should return positive value"
487
433
  )
488
434
 
489
435
  async def testConcurrentOperations(self) -> None:
@@ -602,64 +548,108 @@ class TestAsynchronousExample(AsyncTestCase):
602
548
  """
603
549
  Test async container dependency injection functionality.
604
550
 
605
- Validates the container's ability to resolve services in async
606
- contexts and manage async dependencies. This method demonstrates
607
- async dependency injection patterns and service resolution.
551
+ Validates the application container's ability to resolve services and manage
552
+ dependencies in asynchronous contexts. This method demonstrates async dependency
553
+ injection patterns, service resolution capabilities, and validates that the
554
+ container can properly handle service lifecycle management in async environments.
555
+ The test ensures that services resolved through the container maintain their
556
+ functionality when used in asynchronous operations.
608
557
 
609
558
  Parameters
610
559
  ----------
611
560
  container : Application
612
- Injected application container instance for testing async
613
- dependency injection capabilities.
561
+ Injected application container instance for testing async dependency
562
+ injection capabilities. The container manages service resolution,
563
+ dependency lifecycle, and provides access to registered services
564
+ throughout the async application context.
565
+
566
+ Returns
567
+ -------
568
+ None
569
+ This test method does not return any value. It performs assertions
570
+ to validate the container's async dependency injection functionality
571
+ and service resolution capabilities in asynchronous contexts.
614
572
 
615
573
  Tests
616
574
  -----
617
- - Async service resolution from container
618
- - Async service method execution
619
- - Async dependency lifecycle management
620
- - Async service functionality validation
575
+ - Async service resolution from container using interface contracts
576
+ - Service instance validation after async resolution
577
+ - Async service method execution and functionality verification
578
+ - Dependency lifecycle management in async contexts
579
+ - Interface-to-implementation mapping in async scenarios
621
580
 
622
581
  Raises
623
582
  ------
624
583
  AssertionError
625
- If async container operations fail or services cannot be resolved.
584
+ If async container operations fail, services cannot be resolved,
585
+ service methods return invalid results, or the container instance
586
+ fails to properly manage async dependencies.
587
+
588
+ Notes
589
+ -----
590
+ This test validates the core async dependency injection functionality
591
+ that is essential for the Orionis framework's async service architecture.
592
+ The container must be able to resolve services using their interface
593
+ contracts and provide properly configured instances that work correctly
594
+ in asynchronous execution contexts.
626
595
  """
627
- async def resolve_service_async() -> IResolver:
596
+ async def resolve_service_async() -> IWorkers:
628
597
  """
629
- Simulate async service resolution.
598
+ Simulate async service resolution with I/O delay.
599
+
600
+ Demonstrates async service resolution from the container while
601
+ simulating real-world async I/O operations that might occur
602
+ during service instantiation or configuration.
630
603
 
631
604
  Returns
632
605
  -------
633
- IResolver
634
- Resolved path resolver service instance.
606
+ IWorkers
607
+ Resolved worker service instance implementing the IWorkers interface.
635
608
  """
609
+ # Simulate async I/O operation that might occur during service resolution
636
610
  await asyncio.sleep(0.01)
637
- return container.make(IResolver)
611
+ # Resolve the IWorkers service from the injected container
612
+ return container.make(IWorkers)
638
613
 
639
- # Test async service resolution
640
- path_resolver = await resolve_service_async()
614
+ # Test async service resolution from the container
615
+ # This validates that the container can resolve services in async contexts
616
+ worker_service = await resolve_service_async()
617
+
618
+ # Verify that the async service resolution was successful
619
+ # The container should return a valid instance implementing IWorkers
641
620
  self.assertIsNotNone(
642
- path_resolver,
621
+ worker_service,
643
622
  "Async service resolution should return valid instance"
644
623
  )
645
624
 
646
- async def use_service_async() -> str:
625
+ async def use_service_async() -> int:
647
626
  """
648
- Simulate async service method execution.
627
+ Simulate async service method execution with I/O delay.
628
+
629
+ Demonstrates using a resolved service in an async context while
630
+ simulating real-world async operations that might be performed
631
+ by the service methods.
649
632
 
650
633
  Returns
651
634
  -------
652
- str
653
- Result from async service method call.
635
+ int
636
+ Result from async service method call representing worker count.
654
637
  """
638
+ # Simulate async I/O operation that might occur during service usage
655
639
  await asyncio.sleep(0.01)
656
- return path_resolver.relativePath("README.md").toString()
640
+ # Execute the calculate method on the resolved worker service
641
+ return worker_service.calculate()
657
642
 
658
- # Test async service method execution
643
+ # Test async service method execution after resolution
644
+ # This validates that resolved services function properly in async contexts
659
645
  result = await use_service_async()
660
- self.assertTrue(
661
- result.endswith("README.md"),
662
- "Async service method execution should return correct result"
646
+
647
+ # Verify that the async service method execution returns expected results
648
+ # The worker calculation should return a positive integer representing available workers
649
+ self.assertGreater(
650
+ result,
651
+ 0,
652
+ "Async service method execution should return positive worker count"
663
653
  )
664
654
 
665
655
  async def testAsyncDataProcessing(self) -> None:
@@ -1,43 +0,0 @@
1
- from orionis.container.providers.service_provider import ServiceProvider
2
- from orionis.services.paths.contracts.resolver import IResolver
3
- from orionis.services.paths.resolver import Resolver
4
-
5
- class PathResolverProvider(ServiceProvider):
6
- """
7
- Registers the path resolution service in the application container.
8
-
9
- This provider binds the `IResolver` interface to the `Resolver` implementation,
10
- allowing the application to resolve file system paths through dependency injection.
11
-
12
- Attributes
13
- ----------
14
- app : Application
15
- The application container instance inherited from ServiceProvider.
16
- """
17
-
18
- def register(self) -> None:
19
- """
20
- Register the path resolver service in the application container.
21
-
22
- Binds the `IResolver` interface to the `Resolver` implementation as a transient
23
- service, with the alias "core.orionis.path_resolver".
24
-
25
- Returns
26
- -------
27
- None
28
- """
29
-
30
- self.app.transient(IResolver, Resolver, alias="core.orionis.path_resolver")
31
-
32
- def boot(self) -> None:
33
- """
34
- Perform post-registration initialization if needed.
35
-
36
- This method is a placeholder for any actions required after service registration.
37
-
38
- Returns
39
- -------
40
- None
41
- """
42
-
43
- pass
File without changes
File without changes
@@ -1,51 +0,0 @@
1
- from abc import ABC, abstractmethod
2
-
3
- class IResolver(ABC):
4
-
5
- @abstractmethod
6
- def relativePath(self, relative_path: str) -> 'IResolver':
7
- """
8
- Resolves a relative path into an absolute one and validates its existence.
9
-
10
- Parameters
11
- ----------
12
- relative_path : str
13
- The relative path to resolve.
14
-
15
- Returns
16
- -------
17
- ResolverInterface
18
- The instance itself for method chaining.
19
-
20
- Raises
21
- ------
22
- FileNotFoundError
23
- If the resolved path does not exist.
24
- ValueError
25
- If the resolved path is neither a file nor a directory.
26
- """
27
- pass
28
-
29
- @abstractmethod
30
- def toString(self) -> str:
31
- """
32
- Returns the resolved path as a string.
33
-
34
- Returns
35
- -------
36
- str
37
- The resolved path.
38
- """
39
- pass
40
-
41
- @abstractmethod
42
- def get(self):
43
- """
44
- Returns the resolved path as a Path object.
45
-
46
- Returns
47
- -------
48
- Path
49
- The resolved path.
50
- """
51
- pass
@@ -1,7 +0,0 @@
1
- from .exception import OrionisPathValueException
2
- from .file import OrionisFileNotFoundException
3
-
4
- __all__ = [
5
- "OrionisPathValueException",
6
- "OrionisFileNotFoundException"
7
- ]
@@ -1,19 +0,0 @@
1
- class OrionisPathValueException(Exception):
2
-
3
- def __init__(self, msg: str):
4
- """
5
- Parameters
6
- ----------
7
- msg : str
8
- Descriptive error message explaining the cause of the exception.
9
- """
10
- super().__init__(msg)
11
-
12
- def __str__(self) -> str:
13
- """
14
- Returns
15
- -------
16
- str
17
- Formatted string describing the exception.
18
- """
19
- return str(self.args[0])
@@ -1,19 +0,0 @@
1
- class OrionisFileNotFoundException(Exception):
2
-
3
- def __init__(self, msg: str):
4
- """
5
- Parameters
6
- ----------
7
- msg : str
8
- Descriptive error message explaining the cause of the exception.
9
- """
10
- super().__init__(msg)
11
-
12
- def __str__(self) -> str:
13
- """
14
- Returns
15
- -------
16
- str
17
- Formatted string describing the exception.
18
- """
19
- return str(self.args[0])
@@ -1,95 +0,0 @@
1
- import os
2
- from pathlib import Path
3
- from orionis.services.paths.contracts.resolver import IResolver
4
- from orionis.services.paths.exceptions import (
5
- OrionisFileNotFoundException,
6
- OrionisPathValueException
7
- )
8
-
9
- class Resolver(IResolver):
10
-
11
- def __init__(self, root_path: str = None):
12
- """
13
- Initializes the Resolver instance with the project's root directory.
14
-
15
- Parameters
16
- ----------
17
- root_path : str, optional
18
- The root directory of the project. If not provided, it defaults to the current working directory.
19
- """
20
- self.base_path = Path(root_path).resolve() if root_path else Path(os.getcwd()).resolve()
21
- self.resolved_path = None
22
-
23
- def relativePath(self, relative_path: str) -> 'Resolver':
24
- """
25
- Resolves a given relative path to an absolute path and validates its existence.
26
-
27
- This method combines the project's root directory with the provided relative path,
28
- resolves it to an absolute path, and ensures it exists as either a directory or a file.
29
-
30
- Parameters
31
- ----------
32
- relative_path : str
33
- The relative path to a directory or file to be resolved.
34
-
35
- Returns
36
- -------
37
- Resolver
38
- The current instance of the Resolver class with the resolved path.
39
-
40
- Raises
41
- ------
42
- OrionisFileNotFoundException
43
- If the resolved path does not exist.
44
- OrionisPathValueException
45
- If the resolved path is neither a valid directory nor a file.
46
- """
47
- # Combine the base path with the relative path and resolve it
48
- resolved_path = (self.base_path / relative_path).resolve()
49
-
50
- # Validate that the path exists
51
- if not resolved_path.exists():
52
- raise OrionisFileNotFoundException(f"The requested path does not exist: {resolved_path}")
53
-
54
- # Validate that the path is either a directory or a file
55
- if not (resolved_path.is_dir() or resolved_path.is_file()):
56
- raise OrionisPathValueException(f"The requested path is neither a valid directory nor a file: {resolved_path}")
57
-
58
- # Store the resolved path in the instance variable
59
- self.resolved_path = resolved_path
60
-
61
- # Return the current instance
62
- return self
63
-
64
- def toString(self) -> str:
65
- """
66
- Returns the string representation of the resolved path.
67
-
68
- Returns
69
- -------
70
- str
71
- The resolved path as a string.
72
- """
73
- return str(self.resolved_path)
74
-
75
- def get(self) -> Path:
76
- """
77
- Returns the resolved path as a Path object.
78
-
79
- Returns
80
- -------
81
- Path
82
- The resolved path.
83
- """
84
- return self.resolved_path
85
-
86
- def __str__(self) -> str:
87
- """
88
- Returns the string representation of the resolved path.
89
-
90
- Returns
91
- -------
92
- str
93
- The resolved path as a string.
94
- """
95
- return str(self.resolved_path)
@@ -1,15 +0,0 @@
1
- from orionis.container.facades.facade import Facade
2
-
3
- class PathResolver(Facade):
4
-
5
- @classmethod
6
- def getFacadeAccessor(cls):
7
- """
8
- Returns the binding key for the path resolver service in the container.
9
-
10
- Returns
11
- -------
12
- str
13
- The unique string identifier for the path resolver service, used by the service container.
14
- """
15
- return "core.orionis.path_resolver"
File without changes
@@ -1,112 +0,0 @@
1
- import os
2
- import tempfile
3
- from pathlib import Path
4
- from orionis.services.paths.exceptions import OrionisFileNotFoundException
5
- from orionis.services.paths.resolver import Resolver
6
- from orionis.test.cases.asynchronous import AsyncTestCase
7
-
8
- class TestServicesResolver(AsyncTestCase):
9
-
10
- async def testFileNotFound(self):
11
- """
12
- Test that resolving a non-existent file path raises OrionisFileNotFoundException.
13
-
14
- Returns
15
- -------
16
- None
17
-
18
- Raises
19
- ------
20
- OrionisFileNotFoundException
21
- If the file does not exist.
22
- """
23
- with tempfile.TemporaryDirectory() as tmpdir:
24
- resolver = Resolver(tmpdir)
25
- non_existent = "does_not_exist.txt"
26
- with self.assertRaises(OrionisFileNotFoundException):
27
- resolver.relativePath(non_existent)
28
-
29
- async def testValidFilePath(self):
30
- """
31
- Test that resolving a valid file path returns the correct absolute path.
32
-
33
- Returns
34
- -------
35
- None
36
-
37
- Asserts
38
- -------
39
- The resolved path ends with the file name and is absolute.
40
- """
41
- with tempfile.TemporaryDirectory() as tmpdir:
42
- # Create a temporary file inside the temp directory
43
- file_path = Path(tmpdir) / "testfile.txt"
44
- file_path.write_text("sample content")
45
- resolver = Resolver(tmpdir)
46
- resolved = resolver.relativePath("testfile.txt").toString()
47
- # The resolved path should end with the file name
48
- self.assertTrue(resolved.endswith("testfile.txt"))
49
- # The resolved path should be absolute
50
- self.assertTrue(os.path.isabs(resolved))
51
-
52
- async def testValidDirectoryPath(self):
53
- """
54
- Test that resolving a valid directory path returns the correct absolute path.
55
-
56
- Returns
57
- -------
58
- None
59
-
60
- Asserts
61
- -------
62
- The resolved path ends with the directory name and is absolute.
63
- """
64
- with tempfile.TemporaryDirectory() as tmpdir:
65
- # Create a subdirectory inside the temp directory
66
- subdir = Path(tmpdir) / "subdir"
67
- subdir.mkdir()
68
- resolver = Resolver(tmpdir)
69
- resolved = resolver.relativePath("subdir").toString()
70
- self.assertTrue(resolved.endswith("subdir"))
71
- self.assertTrue(os.path.isabs(resolved))
72
-
73
- async def testOtherBasePath(self):
74
- """
75
- Test that providing a different base path to Resolver works as expected.
76
-
77
- Returns
78
- -------
79
- None
80
-
81
- Asserts
82
- -------
83
- The resolved path ends with the file name and is absolute.
84
- """
85
- with tempfile.TemporaryDirectory() as tmpdir:
86
- # Create a file in a subdirectory
87
- subdir = Path(tmpdir) / "base"
88
- subdir.mkdir()
89
- file_path = subdir / "file.txt"
90
- file_path.write_text("data")
91
- resolver = Resolver(str(subdir))
92
- resolved = resolver.relativePath("file.txt").toString()
93
- self.assertTrue(resolved.endswith("file.txt"))
94
- self.assertTrue(os.path.isabs(resolved))
95
-
96
- async def testEqualOutputString(self):
97
- """
98
- Test that the string representation of the resolved path matches the output of toString().
99
-
100
- Returns
101
- -------
102
- None
103
-
104
- Asserts
105
- -------
106
- The string representation of the resolved path matches the output of toString().
107
- """
108
- with tempfile.TemporaryDirectory() as tmpdir:
109
- file_path = Path(tmpdir) / "file.txt"
110
- file_path.write_text("abc")
111
- resolver = Resolver(tmpdir).relativePath("file.txt")
112
- self.assertEqual(resolver.toString(), str(resolver))