orionis 0.579.0__py3-none-any.whl → 0.580.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.
- orionis/console/core/reactor.py +5 -5
- orionis/console/kernel.py +2 -2
- orionis/console/tasks/schedule.py +2 -2
- orionis/container/container.py +6 -11
- orionis/container/exceptions/__init__.py +4 -4
- orionis/foundation/application.py +116 -91
- orionis/foundation/config/database/entities/sqlite.py +1 -1
- orionis/foundation/config/roots/paths.py +8 -0
- orionis/foundation/config/startup.py +1 -1
- orionis/foundation/contracts/application.py +4 -4
- orionis/foundation/exceptions/__init__.py +6 -4
- orionis/foundation/exceptions/application.py +11 -0
- orionis/foundation/providers/catch_provider.py +1 -1
- orionis/foundation/providers/cli_request_provider.py +1 -1
- orionis/foundation/providers/console_provider.py +1 -1
- orionis/foundation/providers/directory_provider.py +1 -1
- orionis/foundation/providers/dumper_provider.py +1 -1
- orionis/foundation/providers/executor_provider.py +1 -1
- orionis/foundation/providers/inspirational_provider.py +1 -1
- orionis/foundation/providers/logger_provider.py +1 -1
- orionis/foundation/providers/performance_counter_provider.py +1 -1
- orionis/foundation/providers/progress_bar_provider.py +1 -1
- orionis/foundation/providers/reactor_provider.py +1 -2
- orionis/foundation/providers/scheduler_provider.py +1 -1
- orionis/foundation/providers/testing_provider.py +1 -1
- orionis/foundation/providers/workers_provider.py +1 -1
- orionis/metadata/framework.py +1 -1
- orionis/services/asynchrony/exceptions/__init__.py +1 -1
- orionis/services/asynchrony/exceptions/asynchrony.py +11 -0
- orionis/services/environment/core/dot_env.py +3 -2
- orionis/services/environment/dynamic/caster.py +8 -8
- orionis/services/environment/exceptions/__init__.py +11 -3
- orionis/services/environment/exceptions/environment.py +125 -0
- orionis/services/environment/key/key_generator.py +25 -21
- orionis/services/environment/validators/key_name.py +1 -1
- orionis/services/environment/validators/types.py +1 -1
- orionis/services/file/contracts/directory.py +12 -0
- orionis/services/file/directory.py +12 -1
- orionis/services/introspection/dataclass/{attributes.py → extractor.py} +2 -2
- orionis/services/introspection/exceptions/__init__.py +5 -3
- orionis/services/introspection/exceptions/introspection.py +76 -0
- orionis/services/log/exceptions/__init__.py +1 -1
- orionis/support/facades/application.py +3 -2
- orionis/support/facades/console.py +3 -2
- orionis/support/facades/directory.py +3 -2
- orionis/support/facades/dumper.py +3 -2
- orionis/support/facades/executor.py +3 -2
- orionis/support/facades/inspire.py +3 -2
- orionis/support/facades/logger.py +3 -2
- orionis/support/facades/performance_counter.py +3 -2
- orionis/support/facades/progress_bar.py +3 -2
- orionis/support/facades/reactor.py +3 -2
- orionis/support/facades/testing.py +3 -2
- orionis/support/facades/workers.py +5 -4
- orionis/support/standard/exceptions/__init__.py +1 -1
- orionis/support/standard/exceptions/standard.py +23 -0
- orionis/test/core/unit_test.py +10 -1
- orionis/test/kernel.py +21 -19
- orionis/test/output/printer.py +37 -9
- {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/METADATA +1 -1
- {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/RECORD +66 -72
- orionis/foundation/exceptions/integrity.py +0 -19
- orionis/foundation/exceptions/runtime.py +0 -19
- orionis/foundation/exceptions/type.py +0 -19
- orionis/foundation/exceptions/value.py +0 -19
- orionis/services/asynchrony/exceptions/exception.py +0 -27
- orionis/services/environment/exceptions/exception.py +0 -23
- orionis/services/environment/exceptions/value.py +0 -23
- orionis/services/introspection/exceptions/attribute.py +0 -20
- orionis/services/introspection/exceptions/type.py +0 -19
- orionis/services/introspection/exceptions/value.py +0 -19
- orionis/support/standard/exceptions/value.py +0 -19
- /orionis/container/exceptions/{container_exceptions.py → container.py} +0 -0
- /orionis/services/log/exceptions/{runtime.py → log.py} +0 -0
- {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/WHEEL +0 -0
- {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.foundation.contracts.application import IApplication
|
2
3
|
|
3
4
|
class Application(Facade):
|
4
5
|
|
@@ -15,9 +16,9 @@ class Application(Facade):
|
|
15
16
|
Returns
|
16
17
|
-------
|
17
18
|
str
|
18
|
-
The string identifier
|
19
|
+
The string identifier "x-orionis.foundation.contracts.application.IApplication" used as the
|
19
20
|
binding key to resolve the console service from the service container.
|
20
21
|
"""
|
21
22
|
|
22
23
|
# Return the predefined binding key for the console output service
|
23
|
-
return "x-
|
24
|
+
return f"x-{IApplication.__module__}.{IApplication.__name__}"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from orionis.console.contracts.console import IConsole
|
1
2
|
from orionis.container.facades.facade import Facade
|
2
3
|
|
3
4
|
class Console(Facade):
|
@@ -15,9 +16,9 @@ class Console(Facade):
|
|
15
16
|
Returns
|
16
17
|
-------
|
17
18
|
str
|
18
|
-
The string identifier 'x-orionis.console.
|
19
|
+
The string identifier 'x-orionis.console.contracts.console.IConsole' used as the
|
19
20
|
binding key to resolve the console service from the service container.
|
20
21
|
"""
|
21
22
|
|
22
23
|
# Return the predefined binding key for the console output service
|
23
|
-
return "x-
|
24
|
+
return f"x-{IConsole.__module__}.{IConsole.__name__}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.services.file.contracts.directory import IDirectory
|
2
3
|
|
3
4
|
class Directory(Facade):
|
4
5
|
|
@@ -14,8 +15,8 @@ class Directory(Facade):
|
|
14
15
|
Returns
|
15
16
|
-------
|
16
17
|
str
|
17
|
-
The service container binding key 'x-orionis.services.file.contracts.directory'
|
18
|
+
The service container binding key 'x-orionis.services.file.contracts.directory.IDirectory'
|
18
19
|
that identifies the workers service implementation.
|
19
20
|
"""
|
20
21
|
|
21
|
-
return "x-
|
22
|
+
return f"x-{IDirectory.__module__}.{IDirectory.__name__}"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from orionis.console.contracts.debug import IDebug
|
1
2
|
from orionis.container.facades.facade import Facade
|
2
3
|
|
3
4
|
class Dumper(Facade):
|
@@ -14,9 +15,9 @@ class Dumper(Facade):
|
|
14
15
|
Returns
|
15
16
|
-------
|
16
17
|
str
|
17
|
-
The service container binding key "x-orionis.console.
|
18
|
+
The service container binding key "x-orionis.console.contracts.debug.IDebug"
|
18
19
|
that identifies the dumper service instance.
|
19
20
|
"""
|
20
21
|
|
21
22
|
# Return the specific binding key for the dumper service in the container
|
22
|
-
return "x-
|
23
|
+
return f"x-{IDebug.__module__}.{IDebug.__name__}"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from orionis.console.contracts.executor import IExecutor
|
1
2
|
from orionis.container.facades.facade import Facade
|
2
3
|
|
3
4
|
class ConsoleExecutor(Facade):
|
@@ -15,10 +16,10 @@ class ConsoleExecutor(Facade):
|
|
15
16
|
Returns
|
16
17
|
-------
|
17
18
|
str
|
18
|
-
The string identifier 'x-orionis.console.
|
19
|
+
The string identifier 'x-orionis.console.contracts.executor.IExecutor' used as
|
19
20
|
the binding key to locate and resolve the executor service instance
|
20
21
|
from the dependency injection container.
|
21
22
|
"""
|
22
23
|
|
23
24
|
# Return the predefined binding key for the executor service
|
24
|
-
return "x-
|
25
|
+
return f"x-{IExecutor.__module__}.{IExecutor.__name__}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.services.inspirational.contracts.inspire import IInspire
|
2
3
|
|
3
4
|
class Inspire(Facade):
|
4
5
|
|
@@ -15,9 +16,9 @@ class Inspire(Facade):
|
|
15
16
|
Returns
|
16
17
|
-------
|
17
18
|
str
|
18
|
-
The service container binding key 'x-orionis.services.inspirational.inspire'
|
19
|
+
The service container binding key 'x-orionis.services.inspirational.contracts.inspire.IInspire'
|
19
20
|
used to resolve the inspirational service instance.
|
20
21
|
"""
|
21
22
|
|
22
23
|
# Return the service container binding key for the inspirational service
|
23
|
-
return "x-
|
24
|
+
return f"x-{IInspire.__module__}.{IInspire.__name__}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.services.log.contracts.log_service import ILogger
|
2
3
|
|
3
4
|
class Log(Facade):
|
4
5
|
|
@@ -14,10 +15,10 @@ class Log(Facade):
|
|
14
15
|
Returns
|
15
16
|
-------
|
16
17
|
str
|
17
|
-
The service container binding key "x-orionis.services.log.log_service"
|
18
|
+
The service container binding key "x-orionis.services.log.contracts.log_service.ILogger"
|
18
19
|
used to resolve the logger service instance from the dependency
|
19
20
|
injection container.
|
20
21
|
"""
|
21
22
|
|
22
23
|
# Return the service container binding key for the logger service
|
23
|
-
return "x-
|
24
|
+
return f"x-{ILogger.__module__}.{ILogger.__name__}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.support.performance.contracts.counter import IPerformanceCounter
|
2
3
|
|
3
4
|
class PerformanceCounter(Facade):
|
4
5
|
|
@@ -14,8 +15,8 @@ class PerformanceCounter(Facade):
|
|
14
15
|
Returns
|
15
16
|
-------
|
16
17
|
str
|
17
|
-
The service container binding key 'x-orionis.support.performance.counter
|
18
|
+
The service container binding key 'x-orionis.support.performance.contracts.counter.IPerformanceCounter
|
18
19
|
that identifies the workers service implementation.
|
19
20
|
"""
|
20
21
|
|
21
|
-
return "x-
|
22
|
+
return f"x-{IPerformanceCounter.__module__}.{IPerformanceCounter.__name__}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.console.contracts.progress_bar import IProgressBar
|
2
3
|
|
3
4
|
class ProgressBar(Facade):
|
4
5
|
|
@@ -14,8 +15,8 @@ class ProgressBar(Facade):
|
|
14
15
|
Returns
|
15
16
|
-------
|
16
17
|
str
|
17
|
-
The service container binding key 'x-orionis.console.
|
18
|
+
The service container binding key 'x-orionis.console.contracts.progress_bar.IProgressBar
|
18
19
|
used to retrieve the progress bar service instance.
|
19
20
|
"""
|
20
21
|
|
21
|
-
return "x-
|
22
|
+
return f"x-{IProgressBar.__module__}.{IProgressBar.__name__}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.console.contracts.reactor import IReactor
|
2
3
|
|
3
4
|
class Reactor(Facade):
|
4
5
|
|
@@ -15,8 +16,8 @@ class Reactor(Facade):
|
|
15
16
|
Returns
|
16
17
|
-------
|
17
18
|
str
|
18
|
-
The service container binding key "x-orionis.console.
|
19
|
+
The service container binding key "x-orionis.console.contracts.reactor.IReactor"
|
19
20
|
used to resolve the testing component implementation.
|
20
21
|
"""
|
21
22
|
|
22
|
-
return "x-
|
23
|
+
return f"x-{IReactor.__module__}.{IReactor.__name__}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.test.contracts.unit_test import IUnitTest
|
2
3
|
|
3
4
|
class Test(Facade):
|
4
5
|
|
@@ -15,8 +16,8 @@ class Test(Facade):
|
|
15
16
|
Returns
|
16
17
|
-------
|
17
18
|
str
|
18
|
-
The service container binding key "x-orionis.test.
|
19
|
+
The service container binding key "x-orionis.test.contracts.unit_test.IUnitTest"
|
19
20
|
used to resolve the testing component implementation.
|
20
21
|
"""
|
21
22
|
|
22
|
-
return "x-
|
23
|
+
return f"x-{IUnitTest.__module__}.{IUnitTest.__name__}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from orionis.container.facades.facade import Facade
|
2
|
+
from orionis.services.system.contracts.workers import IWorkers
|
2
3
|
|
3
4
|
class Workers(Facade):
|
4
5
|
|
@@ -7,15 +8,15 @@ class Workers(Facade):
|
|
7
8
|
"""
|
8
9
|
Get the registered name of the component in the service container.
|
9
10
|
|
10
|
-
This method provides the binding key that the service container uses to
|
11
|
-
resolve the workers service implementation. It serves as the bridge between
|
11
|
+
This method provides the binding key that the service container uses to
|
12
|
+
resolve the workers service implementation. It serves as the bridge between
|
12
13
|
the facade and the underlying service registration.
|
13
14
|
|
14
15
|
Returns
|
15
16
|
-------
|
16
17
|
str
|
17
|
-
The service container binding key 'x-orionis.services.system.workers'
|
18
|
+
The service container binding key 'x-orionis.services.system.contracts.workers.IWorkers'
|
18
19
|
that identifies the workers service implementation.
|
19
20
|
"""
|
20
21
|
|
21
|
-
return "x-
|
22
|
+
return f"x-{IWorkers.__module__}.{IWorkers.__name__}"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class OrionisStdValueException(Exception):
|
2
|
+
"""
|
3
|
+
Exception raised for errors related to invalid or unexpected values in the Orionis standard support module.
|
4
|
+
|
5
|
+
This exception should be used when a function or operation encounters a value that does not satisfy the required criteria or constraints.
|
6
|
+
|
7
|
+
Parameters
|
8
|
+
----------
|
9
|
+
message : str, optional
|
10
|
+
Error message describing the reason for the exception.
|
11
|
+
|
12
|
+
Returns
|
13
|
+
-------
|
14
|
+
OrionisStdValueException
|
15
|
+
An instance of the exception with an optional error message.
|
16
|
+
|
17
|
+
Attributes
|
18
|
+
----------
|
19
|
+
message : str
|
20
|
+
Optional error message describing the reason for the exception.
|
21
|
+
"""
|
22
|
+
# Inherits from the built-in Exception class to define a custom exception
|
23
|
+
pass
|
orionis/test/core/unit_test.py
CHANGED
@@ -492,12 +492,21 @@ class UnitTest(IUnitTest):
|
|
492
492
|
OrionisTestFailureException
|
493
493
|
If the test suite execution fails and throw_exception is True.
|
494
494
|
"""
|
495
|
+
|
496
|
+
# Length of all tests in the suite
|
497
|
+
total_tests = len(list(self.__flattenTestSuite(self.__suite)))
|
498
|
+
|
499
|
+
# If no tests are found, print a message and return early
|
500
|
+
if total_tests == 0:
|
501
|
+
self.__printer.zeroTestsMessage()
|
502
|
+
return
|
503
|
+
|
495
504
|
# Record the start time in nanoseconds
|
496
505
|
start_time = time.time_ns()
|
497
506
|
|
498
507
|
# Print the start message with test suite details
|
499
508
|
self.__printer.startMessage(
|
500
|
-
length_tests=
|
509
|
+
length_tests=total_tests,
|
501
510
|
execution_mode=self.__execution_mode,
|
502
511
|
max_workers=self.__max_workers
|
503
512
|
)
|
orionis/test/kernel.py
CHANGED
@@ -43,7 +43,7 @@ class TestKernel(ITestKernel):
|
|
43
43
|
config = Testing(**app.config('testing'))
|
44
44
|
|
45
45
|
# Resolve the unit test service from the application container
|
46
|
-
self.__unit_test: IUnitTest = app.make(
|
46
|
+
self.__unit_test: IUnitTest = app.make(IUnitTest)
|
47
47
|
|
48
48
|
# Apply configuration settings to the UnitTest instance
|
49
49
|
self.__unit_test.configure(
|
@@ -68,7 +68,7 @@ class TestKernel(ITestKernel):
|
|
68
68
|
)
|
69
69
|
|
70
70
|
# Initialize the logger service for logging command execution details
|
71
|
-
self.__logger: ILogger = app.make(
|
71
|
+
self.__logger: ILogger = app.make(ILogger)
|
72
72
|
|
73
73
|
def handle(self) -> IUnitTest:
|
74
74
|
"""
|
@@ -89,23 +89,25 @@ class TestKernel(ITestKernel):
|
|
89
89
|
# Log the start of test execution
|
90
90
|
ouput = self.__unit_test.run()
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
92
|
+
if ouput is not None:
|
93
|
+
|
94
|
+
# Extract report details from output
|
95
|
+
total_tests = ouput.get("total_tests")
|
96
|
+
passed = ouput.get("passed")
|
97
|
+
failed = ouput.get("failed")
|
98
|
+
errors = ouput.get("errors")
|
99
|
+
skipped = ouput.get("skipped")
|
100
|
+
total_time = ouput.get("total_time")
|
101
|
+
success_rate = ouput.get("success_rate")
|
102
|
+
timestamp = ouput.get("timestamp")
|
103
|
+
|
104
|
+
# Log test execution completion with detailed summary
|
105
|
+
self.__logger.info(
|
106
|
+
f"Test execution completed at {timestamp} | "
|
107
|
+
f"Total: {total_tests}, Passed: {passed}, Failed: {failed}, "
|
108
|
+
f"Errors: {errors}, Skipped: {skipped}, "
|
109
|
+
f"Time: {total_time:.2f}s, Success rate: {success_rate:.2f}%"
|
110
|
+
)
|
109
111
|
|
110
112
|
# Report the test results to the console
|
111
113
|
return ouput
|
orionis/test/output/printer.py
CHANGED
@@ -84,6 +84,33 @@ class TestPrinter(ITestPrinter):
|
|
84
84
|
else:
|
85
85
|
self.__rich_console.print(str(value))
|
86
86
|
|
87
|
+
def zeroTestsMessage(self) -> None:
|
88
|
+
"""
|
89
|
+
Display a message indicating that no tests were found to execute.
|
90
|
+
|
91
|
+
Returns
|
92
|
+
-------
|
93
|
+
None
|
94
|
+
"""
|
95
|
+
# If not printing results, return early
|
96
|
+
if self.__print_result is False:
|
97
|
+
return
|
98
|
+
|
99
|
+
# Print the message inside a styled Rich panel (not as an error)
|
100
|
+
self.__rich_console.print(
|
101
|
+
Panel(
|
102
|
+
"No tests found to execute.",
|
103
|
+
border_style="yellow",
|
104
|
+
title="No Tests",
|
105
|
+
title_align="center",
|
106
|
+
width=self.__panel_width,
|
107
|
+
padding=(0, 1)
|
108
|
+
)
|
109
|
+
)
|
110
|
+
|
111
|
+
# Add a blank line after the panel for spacing
|
112
|
+
self.__rich_console.line(1)
|
113
|
+
|
87
114
|
def startMessage(
|
88
115
|
self,
|
89
116
|
*,
|
@@ -368,6 +395,12 @@ class TestPrinter(ITestPrinter):
|
|
368
395
|
# If there are no failures or errors, skip to the next test
|
369
396
|
if test["status"] in (TestStatus.FAILED.name, TestStatus.ERRORED.name):
|
370
397
|
|
398
|
+
# Determine the status icon based on the test status
|
399
|
+
if test["status"] == TestStatus.FAILED.name:
|
400
|
+
status_icon = "❌ FAILED: "
|
401
|
+
else:
|
402
|
+
status_icon = "💥 ERRORED: "
|
403
|
+
|
371
404
|
# Print separator line before each test result with class name and method name
|
372
405
|
self.__rich_console.rule(title=f'🧪 {test["class"]}.{test["method"]}()', align="left")
|
373
406
|
|
@@ -388,16 +421,12 @@ class TestPrinter(ITestPrinter):
|
|
388
421
|
self.__rich_console.print(text)
|
389
422
|
|
390
423
|
# Print the error message with better formatting
|
391
|
-
text = Text(
|
392
|
-
text.append(f'{_function}()', style="bold cyan")
|
393
|
-
text.append(": ", style="bold red")
|
394
|
-
|
395
|
-
# Extract just the first line of the error message for cleaner display
|
424
|
+
text = Text(status_icon, style="red")
|
396
425
|
error_msg = test["error_message"] if test["error_message"] else "Unknown error"
|
397
|
-
text.append(error_msg, style="
|
426
|
+
text.append(error_msg, style="yellow")
|
398
427
|
self.__rich_console.print(text)
|
399
428
|
|
400
|
-
# Print the code context (
|
429
|
+
# Print the code context (1 line before and 2 lines after the error)
|
401
430
|
try:
|
402
431
|
|
403
432
|
# Open the file and read its lines
|
@@ -438,8 +467,7 @@ class TestPrinter(ITestPrinter):
|
|
438
467
|
self.__rich_console.print(text)
|
439
468
|
|
440
469
|
# Print the error message with better formatting
|
441
|
-
text = Text(
|
442
|
-
text.append(f'{test["error_message"]}', style="red")
|
470
|
+
text = Text(status_icon, style="bold red")
|
443
471
|
self.__rich_console.print(text)
|
444
472
|
|
445
473
|
# Print traceback if available
|