orionis 0.479.0__py3-none-any.whl → 0.481.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/commands/scheduler_work.py +88 -0
- orionis/console/commands/test.py +16 -9
- orionis/console/core/reactor.py +5 -3
- orionis/console/kernel.py +1 -1
- orionis/console/tasks/exception_report.py +94 -0
- orionis/console/tasks/schedule.py +66 -12
- orionis/container/container.py +33 -22
- orionis/container/facades/facade.py +3 -2
- orionis/foundation/application.py +10 -5
- orionis/foundation/config/roots/paths.py +0 -1
- orionis/foundation/contracts/application.py +2 -2
- orionis/foundation/providers/scheduler_provider.py +51 -0
- orionis/metadata/framework.py +1 -1
- orionis/test/core/unit_test.py +2 -3
- orionis/test/kernel.py +1 -1
- {orionis-0.479.0.dist-info → orionis-0.481.0.dist-info}/METADATA +1 -1
- {orionis-0.479.0.dist-info → orionis-0.481.0.dist-info}/RECORD +22 -19
- tests/testing/test_testing_unit.py +8 -7
- {orionis-0.479.0.dist-info → orionis-0.481.0.dist-info}/WHEEL +0 -0
- {orionis-0.479.0.dist-info → orionis-0.481.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.479.0.dist-info → orionis-0.481.0.dist-info}/top_level.txt +0 -0
- {orionis-0.479.0.dist-info → orionis-0.481.0.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import importlib
|
|
2
|
+
import os
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from orionis.console.base.command import BaseCommand
|
|
5
|
+
from orionis.console.contracts.schedule import ISchedule
|
|
6
|
+
from orionis.console.exceptions import CLIOrionisRuntimeError
|
|
7
|
+
from orionis.foundation.contracts.application import IApplication
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.panel import Panel
|
|
10
|
+
from rich.text import Text
|
|
11
|
+
from datetime import datetime
|
|
12
|
+
|
|
13
|
+
class ScheduleWorkCommand(BaseCommand):
|
|
14
|
+
"""
|
|
15
|
+
Command class to display usage information for the Orionis CLI.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
# Indicates whether timestamps will be shown in the command output
|
|
19
|
+
timestamps: bool = False
|
|
20
|
+
|
|
21
|
+
# Command signature and description
|
|
22
|
+
signature: str = "schedule:work"
|
|
23
|
+
|
|
24
|
+
# Command description
|
|
25
|
+
description: str = "Executes the scheduled tasks defined in the application."
|
|
26
|
+
|
|
27
|
+
async def handle(self, orionis: IApplication, console: Console) -> bool:
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
|
|
31
|
+
# Obtener la ruta absoluta del scheduler desde la configuración de la aplicación
|
|
32
|
+
scheduler_path = orionis.path('console_scheduler')
|
|
33
|
+
|
|
34
|
+
# Obtener la base path desde la variable de entorno o desde la configuración local
|
|
35
|
+
base_path = Path(os.getcwd()).resolve()
|
|
36
|
+
scheduler_path = Path(scheduler_path).resolve()
|
|
37
|
+
rel_path = scheduler_path.relative_to(base_path)
|
|
38
|
+
|
|
39
|
+
# Reemplazar los separadores por puntos y quitar la extensión .py
|
|
40
|
+
module_name = ".".join(rel_path.with_suffix('').parts)
|
|
41
|
+
|
|
42
|
+
# Importar el módulo del scheduler
|
|
43
|
+
scheduler_module = importlib.import_module(module_name)
|
|
44
|
+
|
|
45
|
+
# Obtener la clase Scheduler del módulo importado
|
|
46
|
+
Scheduler = getattr(scheduler_module, "Scheduler", None)
|
|
47
|
+
|
|
48
|
+
# Check if the Scheduler class was found
|
|
49
|
+
if Scheduler is None:
|
|
50
|
+
raise CLIOrionisRuntimeError(f"Scheduler class not found in module {module_name}")
|
|
51
|
+
|
|
52
|
+
# Obtener el método tasks de la clase Scheduler
|
|
53
|
+
task_method = getattr(Scheduler, "tasks", None)
|
|
54
|
+
|
|
55
|
+
# Check if the method exists
|
|
56
|
+
if task_method is None:
|
|
57
|
+
raise CLIOrionisRuntimeError(f"Method 'tasks' not found in Scheduler class in module {module_name}")
|
|
58
|
+
|
|
59
|
+
# Crear una instancia de ISchedule
|
|
60
|
+
schedule_serice: ISchedule = orionis.make(ISchedule)
|
|
61
|
+
|
|
62
|
+
# Inicializar el metodo
|
|
63
|
+
task_method(schedule_serice)
|
|
64
|
+
|
|
65
|
+
# Display a professional start message for the scheduler worker
|
|
66
|
+
console.line()
|
|
67
|
+
start_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
|
68
|
+
panel_content = Text.assemble(
|
|
69
|
+
(" Orionis Scheduler Worker ", "bold white on green"),
|
|
70
|
+
("\n\n", ""),
|
|
71
|
+
("The scheduled tasks worker has started successfully.\n", "white"),
|
|
72
|
+
(f"Started at: {start_time}\n", "dim"),
|
|
73
|
+
("To stop the worker, press ", "white"),
|
|
74
|
+
("Ctrl+C", "bold yellow"),
|
|
75
|
+
(".", "white")
|
|
76
|
+
)
|
|
77
|
+
console.print(
|
|
78
|
+
Panel(panel_content, border_style="green", padding=(1, 2))
|
|
79
|
+
)
|
|
80
|
+
console.line()
|
|
81
|
+
|
|
82
|
+
# Iniciar el scheduler
|
|
83
|
+
await schedule_serice.start()
|
|
84
|
+
|
|
85
|
+
except Exception as exc:
|
|
86
|
+
|
|
87
|
+
# Catch any unexpected exceptions and raise as a CLIOrionisRuntimeError
|
|
88
|
+
raise CLIOrionisRuntimeError(f"An unexpected error occurred while clearing the cache: {exc}")
|
orionis/console/commands/test.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from orionis.app import Orionis
|
|
2
2
|
from orionis.console.base.command import BaseCommand
|
|
3
3
|
from orionis.console.exceptions import CLIOrionisRuntimeError
|
|
4
|
+
from orionis.foundation.contracts.application import IApplication
|
|
4
5
|
from orionis.test.contracts.kernel import ITestKernel
|
|
5
6
|
|
|
6
7
|
class TestCommand(BaseCommand):
|
|
@@ -26,28 +27,34 @@ class TestCommand(BaseCommand):
|
|
|
26
27
|
# Command description
|
|
27
28
|
description: str = "Executes all automated tests using the configured test kernel for the Orionis application."
|
|
28
29
|
|
|
29
|
-
def handle(self) -> dict:
|
|
30
|
+
def handle(self, app: IApplication) -> dict:
|
|
30
31
|
"""
|
|
31
|
-
Executes
|
|
32
|
+
Executes all automated tests using the configured test kernel.
|
|
32
33
|
|
|
33
|
-
This method
|
|
34
|
-
and
|
|
35
|
-
execution, it raises a CLIOrionisRuntimeError with
|
|
34
|
+
This method retrieves the test kernel instance from the application container
|
|
35
|
+
and executes the test suite by invoking the kernel's handle method. If any
|
|
36
|
+
exception occurs during execution, it raises a CLIOrionisRuntimeError with
|
|
37
|
+
the error details.
|
|
38
|
+
|
|
39
|
+
Parameters
|
|
40
|
+
----------
|
|
41
|
+
app : IApplication
|
|
42
|
+
The Orionis application instance providing access to the service container.
|
|
36
43
|
|
|
37
44
|
Returns
|
|
38
45
|
-------
|
|
39
46
|
dict
|
|
40
|
-
|
|
47
|
+
A dictionary containing the results of the test execution, such as test
|
|
48
|
+
statuses, counts, or other relevant information.
|
|
41
49
|
|
|
42
50
|
Raises
|
|
43
51
|
------
|
|
44
52
|
CLIOrionisRuntimeError
|
|
45
53
|
If an unexpected error occurs during the execution of the test command.
|
|
46
54
|
"""
|
|
47
|
-
try:
|
|
48
55
|
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
# Attempt to execute the test suite using the test kernel
|
|
57
|
+
try:
|
|
51
58
|
|
|
52
59
|
# Retrieve the test kernel instance from the application container
|
|
53
60
|
kernel: ITestKernel = app.make(ITestKernel)
|
orionis/console/core/reactor.py
CHANGED
|
@@ -21,7 +21,7 @@ class Reactor(IReactor):
|
|
|
21
21
|
|
|
22
22
|
def __init__(
|
|
23
23
|
self,
|
|
24
|
-
app:
|
|
24
|
+
app: IApplication
|
|
25
25
|
):
|
|
26
26
|
"""
|
|
27
27
|
Initializes a new Reactor instance for command discovery and management.
|
|
@@ -56,7 +56,7 @@ class Reactor(IReactor):
|
|
|
56
56
|
"""
|
|
57
57
|
|
|
58
58
|
# Initialize the application instance, using provided app or creating new Orionis instance
|
|
59
|
-
self.__app = app
|
|
59
|
+
self.__app = app
|
|
60
60
|
|
|
61
61
|
# Set the project root directory to current working directory for module path resolution
|
|
62
62
|
self.__root: str = str(Path.cwd())
|
|
@@ -111,6 +111,7 @@ class Reactor(IReactor):
|
|
|
111
111
|
from orionis.console.commands.publisher import PublisherCommand
|
|
112
112
|
from orionis.console.commands.workflow import WorkFlowGithubCommand
|
|
113
113
|
from orionis.console.commands.cache import CacheClearCommand
|
|
114
|
+
from orionis.console.commands.scheduler_work import ScheduleWorkCommand
|
|
114
115
|
|
|
115
116
|
# List of core command classes to load (extend this list as more core commands are added)
|
|
116
117
|
core_commands = [
|
|
@@ -119,7 +120,8 @@ class Reactor(IReactor):
|
|
|
119
120
|
TestCommand,
|
|
120
121
|
PublisherCommand,
|
|
121
122
|
WorkFlowGithubCommand,
|
|
122
|
-
CacheClearCommand
|
|
123
|
+
CacheClearCommand,
|
|
124
|
+
ScheduleWorkCommand
|
|
123
125
|
]
|
|
124
126
|
|
|
125
127
|
# Iterate through the core command classes and register them
|
orionis/console/kernel.py
CHANGED
|
@@ -38,7 +38,7 @@ class KernelCLI(IKernelCLI):
|
|
|
38
38
|
|
|
39
39
|
# Retrieve and initialize the reactor instance from the application container.
|
|
40
40
|
# The reactor is responsible for dispatching CLI commands.
|
|
41
|
-
self.__reactor: IReactor = app.make('x-orionis.console.core.reactor'
|
|
41
|
+
self.__reactor: IReactor = app.make('x-orionis.console.core.reactor')
|
|
42
42
|
|
|
43
43
|
# Retrieve and initialize the console instance for command output and error handling.
|
|
44
44
|
self.__console: IConsole = app.make('x-orionis.console.output.console')
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
from rich.console import Console
|
|
2
|
+
from rich.panel import Panel
|
|
3
|
+
from rich.text import Text
|
|
4
|
+
from rich.traceback import Traceback
|
|
5
|
+
|
|
6
|
+
class ScheduleErrorReporter:
|
|
7
|
+
"""Handles and displays errors and warnings with rich formatting using the Rich library.
|
|
8
|
+
|
|
9
|
+
This class provides methods to output formatted error and warning messages to the console,
|
|
10
|
+
enhancing readability and debugging using the Rich library's features.
|
|
11
|
+
|
|
12
|
+
Attributes
|
|
13
|
+
----------
|
|
14
|
+
console : Console
|
|
15
|
+
Rich Console object used for rendering formatted output to the terminal.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self):
|
|
19
|
+
"""
|
|
20
|
+
Initialize the ErrorReporter instance.
|
|
21
|
+
|
|
22
|
+
This constructor creates a new Console object from the Rich library and assigns it to the 'console' attribute,
|
|
23
|
+
which is used for rendering formatted output to the terminal.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
None
|
|
28
|
+
This constructor does not return any value.
|
|
29
|
+
"""
|
|
30
|
+
self.console = Console()
|
|
31
|
+
|
|
32
|
+
def reportException(self, job_id: str, exception: Exception, traceback: str = None):
|
|
33
|
+
"""
|
|
34
|
+
Display a formatted error message for an exception that occurred during a job execution.
|
|
35
|
+
|
|
36
|
+
This method prints a visually enhanced error panel to the console, including the job identifier and the exception message.
|
|
37
|
+
If a traceback string is provided, it is rendered below the error panel for detailed debugging information.
|
|
38
|
+
|
|
39
|
+
Parameters
|
|
40
|
+
----------
|
|
41
|
+
job_id : str
|
|
42
|
+
The identifier of the job where the exception occurred.
|
|
43
|
+
exception : Exception
|
|
44
|
+
The exception instance that was raised.
|
|
45
|
+
traceback : str, optional
|
|
46
|
+
The string representation of the traceback. If provided, it will be displayed after the error message.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
None
|
|
51
|
+
This method does not return any value. It outputs formatted error information to the console.
|
|
52
|
+
"""
|
|
53
|
+
title = f"[bold red]Job Execution Error[/bold red]"
|
|
54
|
+
message = Text.assemble(
|
|
55
|
+
("An exception occurred during the execution of job ", "white"),
|
|
56
|
+
(f"'{job_id}'", "bold cyan"),
|
|
57
|
+
(":\n", "white"),
|
|
58
|
+
(f"{type(exception).__name__}: {exception}", "red")
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
self.console.print(Panel(message, title=title, border_style="red", padding=(1, 2)))
|
|
62
|
+
if traceback:
|
|
63
|
+
tb = Traceback.from_string(traceback)
|
|
64
|
+
self.console.print(tb)
|
|
65
|
+
self.console.line()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def reportMissed(self, job_id: str, scheduled_time):
|
|
69
|
+
"""
|
|
70
|
+
Display a formatted warning message for a missed job execution.
|
|
71
|
+
|
|
72
|
+
This method prints a warning panel to the console, indicating that a scheduled job was missed and showing its scheduled time.
|
|
73
|
+
|
|
74
|
+
Parameters
|
|
75
|
+
----------
|
|
76
|
+
job_id : str
|
|
77
|
+
The identifier of the missed job.
|
|
78
|
+
scheduled_time : Any
|
|
79
|
+
The time the job was scheduled to run.
|
|
80
|
+
|
|
81
|
+
Returns
|
|
82
|
+
-------
|
|
83
|
+
None
|
|
84
|
+
This method does not return any value. It outputs a warning message to the console.
|
|
85
|
+
"""
|
|
86
|
+
title = f"[bold yellow]Missed Scheduled Job[/bold yellow]"
|
|
87
|
+
msg = Text.assemble(
|
|
88
|
+
("The scheduled job ", "white"),
|
|
89
|
+
(f"'{job_id}'", "bold cyan"),
|
|
90
|
+
(" was not executed as planned.\nScheduled time: ", "white"),
|
|
91
|
+
(f"{scheduled_time}", "bold green")
|
|
92
|
+
)
|
|
93
|
+
self.console.print(Panel(msg, title=title, border_style="yellow", padding=(1, 2)))
|
|
94
|
+
self.console.line()
|
|
@@ -2,19 +2,25 @@ import asyncio
|
|
|
2
2
|
import logging
|
|
3
3
|
from typing import Dict, List, Optional
|
|
4
4
|
import pytz
|
|
5
|
+
from apscheduler.events import EVENT_JOB_MISSED, EVENT_JOB_ERROR
|
|
5
6
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler as APSAsyncIOScheduler
|
|
6
|
-
from orionis.app import Orionis
|
|
7
7
|
from orionis.console.contracts.reactor import IReactor
|
|
8
8
|
from orionis.console.contracts.schedule import ISchedule
|
|
9
9
|
from orionis.console.exceptions import CLIOrionisRuntimeError
|
|
10
|
+
from orionis.console.output.contracts.console import IConsole
|
|
10
11
|
from orionis.console.tasks.event import Event
|
|
12
|
+
from orionis.console.tasks.exception_report import ScheduleErrorReporter
|
|
13
|
+
from orionis.foundation.contracts.application import IApplication
|
|
11
14
|
from orionis.services.log.contracts.log_service import ILogger
|
|
12
15
|
|
|
13
16
|
class Scheduler(ISchedule):
|
|
14
17
|
|
|
15
18
|
def __init__(
|
|
16
19
|
self,
|
|
17
|
-
reactor: IReactor
|
|
20
|
+
reactor: IReactor,
|
|
21
|
+
app: IApplication,
|
|
22
|
+
console: IConsole,
|
|
23
|
+
error_reporter: ScheduleErrorReporter
|
|
18
24
|
) -> None:
|
|
19
25
|
"""
|
|
20
26
|
Initialize a new instance of the Scheduler class.
|
|
@@ -37,7 +43,13 @@ class Scheduler(ISchedule):
|
|
|
37
43
|
"""
|
|
38
44
|
|
|
39
45
|
# Store the application instance for configuration access.
|
|
40
|
-
self.__app =
|
|
46
|
+
self.__app = app
|
|
47
|
+
|
|
48
|
+
# Store the console instance for output operations.
|
|
49
|
+
self.__console = console
|
|
50
|
+
|
|
51
|
+
# Store the error reporter instance for handling exceptions.
|
|
52
|
+
self.__error_reporter = error_reporter
|
|
41
53
|
|
|
42
54
|
# Initialize AsyncIOScheduler instance with timezone configuration.
|
|
43
55
|
self.__scheduler: APSAsyncIOScheduler = APSAsyncIOScheduler(
|
|
@@ -46,8 +58,11 @@ class Scheduler(ISchedule):
|
|
|
46
58
|
|
|
47
59
|
# Clear the APScheduler logger to prevent conflicts with other loggers.
|
|
48
60
|
# This is necessary to avoid duplicate log messages or conflicts with other logging configurations.
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
for name in ["apscheduler", "apscheduler.scheduler", "apscheduler.executors.default"]:
|
|
62
|
+
logger = logging.getLogger(name)
|
|
63
|
+
logger.handlers.clear()
|
|
64
|
+
logger.propagate = False
|
|
65
|
+
logger.disabled = True
|
|
51
66
|
|
|
52
67
|
# Initialize the logger from the application instance.
|
|
53
68
|
self.__logger: ILogger = self.__app.make('x-orionis.services.log.log_service')
|
|
@@ -64,9 +79,52 @@ class Scheduler(ISchedule):
|
|
|
64
79
|
# Initialize the jobs list to keep track of all scheduled jobs.
|
|
65
80
|
self.__jobs: List[dict] = []
|
|
66
81
|
|
|
82
|
+
# Add a listener to the scheduler to capture job events such as missed jobs or errors.
|
|
83
|
+
self.__scheduler.add_listener(self.__listener, EVENT_JOB_MISSED | EVENT_JOB_ERROR)
|
|
84
|
+
|
|
67
85
|
# Log the initialization of the Scheduler.
|
|
68
86
|
self.__logger.info("Orionis scheduler initialized.")
|
|
69
87
|
|
|
88
|
+
def __listener(self, event):
|
|
89
|
+
"""
|
|
90
|
+
Handle job events by logging errors and missed jobs.
|
|
91
|
+
|
|
92
|
+
This method acts as a listener for job events emitted by the scheduler. It processes
|
|
93
|
+
two main types of events: job execution errors and missed job executions. When a job
|
|
94
|
+
raises an exception during execution, the method logs the error and delegates reporting
|
|
95
|
+
to the error reporter. If a job is missed (i.e., not executed at its scheduled time),
|
|
96
|
+
the method logs a warning and notifies the error reporter accordingly.
|
|
97
|
+
|
|
98
|
+
Parameters
|
|
99
|
+
----------
|
|
100
|
+
event : apscheduler.events.JobEvent
|
|
101
|
+
The job event object containing information about the job execution, such as
|
|
102
|
+
job_id, exception, traceback, code, and scheduled_run_time.
|
|
103
|
+
|
|
104
|
+
Returns
|
|
105
|
+
-------
|
|
106
|
+
None
|
|
107
|
+
This method does not return any value. It performs logging and error reporting
|
|
108
|
+
based on the event type.
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
# If the event contains an exception, log the error and report it
|
|
112
|
+
if event.exception:
|
|
113
|
+
self.__logger.error(f"Job {event.job_id} raised an exception: {event.exception}")
|
|
114
|
+
self.__error_reporter.reportException(
|
|
115
|
+
job_id=event.job_id,
|
|
116
|
+
exception=event.exception,
|
|
117
|
+
traceback=event.traceback
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
# If the event indicates a missed job, log a warning and report it
|
|
121
|
+
elif event.code == EVENT_JOB_MISSED:
|
|
122
|
+
self.__logger.warning(f"Job {event.job_id} was missed, scheduled for {event.scheduled_run_time}")
|
|
123
|
+
self.__error_reporter.reportMissed(
|
|
124
|
+
job_id=event.job_id,
|
|
125
|
+
scheduled_time=event.scheduled_run_time
|
|
126
|
+
)
|
|
127
|
+
|
|
70
128
|
def __getCommands(
|
|
71
129
|
self
|
|
72
130
|
) -> dict:
|
|
@@ -285,14 +343,10 @@ class Scheduler(ISchedule):
|
|
|
285
343
|
|
|
286
344
|
# Keep the event loop alive to process scheduled jobs
|
|
287
345
|
try:
|
|
288
|
-
|
|
289
|
-
# Wait for the scheduler to start and keep it running
|
|
290
|
-
while True:
|
|
346
|
+
while self.__scheduler.running and self.__scheduler.get_jobs():
|
|
291
347
|
await asyncio.sleep(1)
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
# Handle graceful shutdown on keyboard interrupt
|
|
348
|
+
except (KeyboardInterrupt, asyncio.CancelledError):
|
|
349
|
+
# Handle graceful shutdown on keyboard interrupt or cancellation
|
|
296
350
|
await self.shutdown()
|
|
297
351
|
|
|
298
352
|
except Exception as e:
|
orionis/container/container.py
CHANGED
|
@@ -511,35 +511,46 @@ class Container(IContainer):
|
|
|
511
511
|
registered in the container under both the abstract and the alias.
|
|
512
512
|
"""
|
|
513
513
|
|
|
514
|
-
#
|
|
515
|
-
|
|
514
|
+
# Validate the enforce_decoupling parameter
|
|
515
|
+
if isinstance(enforce_decoupling, bool):
|
|
516
516
|
|
|
517
|
-
|
|
518
|
-
|
|
517
|
+
# Ensure that the abstract is an abstract class
|
|
518
|
+
IsAbstractClass(abstract, f"Instance {Lifetime.SINGLETON}")
|
|
519
519
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
IsNotSubclass(abstract, instance.__class__)
|
|
520
|
+
# Ensure that the instance is a valid instance
|
|
521
|
+
IsInstance(instance)
|
|
523
522
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
523
|
+
# Ensure that instance is NOT a subclass of abstract
|
|
524
|
+
if enforce_decoupling:
|
|
525
|
+
IsNotSubclass(abstract, instance.__class__)
|
|
527
526
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
527
|
+
# Validate that instance is a subclass of abstract
|
|
528
|
+
else:
|
|
529
|
+
IsSubclass(abstract, instance.__class__)
|
|
530
|
+
|
|
531
|
+
# Ensure implementation
|
|
532
|
+
ImplementsAbstractMethods(
|
|
533
|
+
abstract=abstract,
|
|
534
|
+
instance=instance
|
|
535
|
+
)
|
|
536
|
+
|
|
537
|
+
# Ensure that the alias is a valid string if provided
|
|
538
|
+
if alias:
|
|
539
|
+
IsValidAlias(alias)
|
|
540
|
+
else:
|
|
541
|
+
rf_asbtract = ReflectionAbstract(abstract)
|
|
542
|
+
alias = rf_asbtract.getModuleWithClassName()
|
|
543
|
+
|
|
544
|
+
# If the service is already registered, drop it
|
|
545
|
+
self.drop(abstract, alias)
|
|
533
546
|
|
|
534
|
-
# Ensure that the alias is a valid string if provided
|
|
535
|
-
if alias:
|
|
536
|
-
IsValidAlias(alias)
|
|
537
547
|
else:
|
|
538
|
-
rf_asbtract = ReflectionAbstract(abstract)
|
|
539
|
-
alias = rf_asbtract.getModuleWithClassName()
|
|
540
548
|
|
|
541
|
-
|
|
542
|
-
|
|
549
|
+
# Drop the existing alias if it exists
|
|
550
|
+
self.drop(alias=alias)
|
|
551
|
+
|
|
552
|
+
# If enforce_decoupling is not a boolean, set it to False
|
|
553
|
+
enforce_decoupling = False
|
|
543
554
|
|
|
544
555
|
# Register the instance with the abstract type
|
|
545
556
|
self.__bindings[abstract] = Binding(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
+
from orionis.app import Orionis
|
|
2
3
|
from orionis.container.exceptions import OrionisContainerAttributeError, OrionisContainerException
|
|
3
|
-
from orionis.foundation.application import
|
|
4
|
+
from orionis.foundation.application import IApplication
|
|
4
5
|
from typing import TypeVar, Any
|
|
5
6
|
|
|
6
7
|
T = TypeVar('T')
|
|
@@ -34,7 +35,7 @@ class FacadeMeta(type):
|
|
|
34
35
|
class Facade(metaclass=FacadeMeta):
|
|
35
36
|
|
|
36
37
|
# Application instance to resolve services
|
|
37
|
-
_app: IApplication =
|
|
38
|
+
_app: IApplication = Orionis()
|
|
38
39
|
|
|
39
40
|
@classmethod
|
|
40
41
|
def getFacadeAccessor(cls) -> str:
|
|
@@ -150,8 +150,8 @@ class Application(Container, IApplication):
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
# Register each kernel instance
|
|
153
|
-
for
|
|
154
|
-
self.instance(
|
|
153
|
+
for abstract, concrete in core_kernels.items():
|
|
154
|
+
self.instance(abstract, concrete(self))
|
|
155
155
|
|
|
156
156
|
def __loadFrameworkProviders(
|
|
157
157
|
self
|
|
@@ -181,6 +181,7 @@ class Application(Container, IApplication):
|
|
|
181
181
|
from orionis.foundation.providers.executor_provider import ConsoleExecuteProvider
|
|
182
182
|
from orionis.foundation.providers.reactor_provider import ReactorProvider
|
|
183
183
|
from orionis.foundation.providers.performance_counter_provider import PerformanceCounterProvider
|
|
184
|
+
from orionis.foundation.providers.scheduler_provider import ScheduleProvider
|
|
184
185
|
|
|
185
186
|
# Core framework providers
|
|
186
187
|
core_providers = [
|
|
@@ -193,7 +194,8 @@ class Application(Container, IApplication):
|
|
|
193
194
|
InspirationalProvider,
|
|
194
195
|
ConsoleExecuteProvider,
|
|
195
196
|
ReactorProvider,
|
|
196
|
-
PerformanceCounterProvider
|
|
197
|
+
PerformanceCounterProvider,
|
|
198
|
+
ScheduleProvider
|
|
197
199
|
]
|
|
198
200
|
|
|
199
201
|
# Register each core provider
|
|
@@ -1812,7 +1814,7 @@ class Application(Container, IApplication):
|
|
|
1812
1814
|
self,
|
|
1813
1815
|
key: str = None,
|
|
1814
1816
|
default: Any = None
|
|
1815
|
-
) ->
|
|
1817
|
+
) -> str:
|
|
1816
1818
|
"""
|
|
1817
1819
|
Retrieve application path configuration values using dot notation.
|
|
1818
1820
|
|
|
@@ -1832,7 +1834,7 @@ class Application(Container, IApplication):
|
|
|
1832
1834
|
|
|
1833
1835
|
Returns
|
|
1834
1836
|
-------
|
|
1835
|
-
|
|
1837
|
+
str
|
|
1836
1838
|
The path configuration value corresponding to the given key, the entire
|
|
1837
1839
|
paths dictionary if key is None, or the default value if the key is
|
|
1838
1840
|
not found.
|
|
@@ -1923,6 +1925,9 @@ class Application(Container, IApplication):
|
|
|
1923
1925
|
# Check if already booted
|
|
1924
1926
|
if not self.__booted:
|
|
1925
1927
|
|
|
1928
|
+
# Register the application instance in the container
|
|
1929
|
+
self.instance(IApplication, self, alias="x-orionis.foundation.application", enforce_decoupling='X-ORIONIS')
|
|
1930
|
+
|
|
1926
1931
|
# Load configuration if not already set
|
|
1927
1932
|
self.__loadConfig()
|
|
1928
1933
|
|
|
@@ -705,7 +705,7 @@ class IApplication(IContainer):
|
|
|
705
705
|
pass
|
|
706
706
|
|
|
707
707
|
@abstractmethod
|
|
708
|
-
def path(self, key: str = None, default: Any = None) ->
|
|
708
|
+
def path(self, key: str = None, default: Any = None) -> str:
|
|
709
709
|
"""
|
|
710
710
|
Retrieve path configuration values using dot notation access.
|
|
711
711
|
|
|
@@ -723,7 +723,7 @@ class IApplication(IContainer):
|
|
|
723
723
|
|
|
724
724
|
Returns
|
|
725
725
|
-------
|
|
726
|
-
|
|
726
|
+
str
|
|
727
727
|
The path value associated with the key, the entire paths configuration
|
|
728
728
|
object if no key is provided, or the default value if the key is not found.
|
|
729
729
|
"""
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from orionis.console.contracts.schedule import ISchedule
|
|
2
|
+
from orionis.console.tasks.schedule import Scheduler
|
|
3
|
+
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
|
+
|
|
5
|
+
class ScheduleProvider(ServiceProvider):
|
|
6
|
+
"""
|
|
7
|
+
Service provider responsible for registering and bootstrapping the application's scheduling system.
|
|
8
|
+
|
|
9
|
+
The ScheduleProvider binds the ISchedule interface to the Scheduler implementation as a singleton
|
|
10
|
+
within the application's service container. It also provides an alias for convenient access.
|
|
11
|
+
Override the `boot` method to configure and register scheduled tasks or jobs required by the application.
|
|
12
|
+
|
|
13
|
+
Methods
|
|
14
|
+
-------
|
|
15
|
+
register() :
|
|
16
|
+
Registers the Scheduler as a singleton service and binds it to the ISchedule interface.
|
|
17
|
+
boot() :
|
|
18
|
+
Initializes and configures scheduled tasks; intended to be overridden for custom jobs.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def register(self) -> None:
|
|
22
|
+
"""
|
|
23
|
+
Register the Scheduler as a singleton service in the application container.
|
|
24
|
+
|
|
25
|
+
This method binds the ISchedule interface to the Scheduler implementation,
|
|
26
|
+
making it available as a singleton throughout the application's lifecycle.
|
|
27
|
+
An alias "x-orionis.console.contracts.schedule" is also provided for
|
|
28
|
+
convenient access.
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
None
|
|
33
|
+
This method does not return any value.
|
|
34
|
+
"""
|
|
35
|
+
# Bind Scheduler as a singleton to the ISchedule interface with an alias
|
|
36
|
+
self.app.singleton(ISchedule, Scheduler, alias="x-orionis.console.contracts.schedule")
|
|
37
|
+
|
|
38
|
+
def boot(self) -> None:
|
|
39
|
+
"""
|
|
40
|
+
Initialize and configure any scheduled tasks or jobs required by the application.
|
|
41
|
+
|
|
42
|
+
This method is called automatically during the application's bootstrapping process.
|
|
43
|
+
Override this method to register custom scheduled tasks.
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
None
|
|
48
|
+
This method does not return any value.
|
|
49
|
+
"""
|
|
50
|
+
# No scheduled tasks are registered by default; override to add custom jobs
|
|
51
|
+
pass
|
orionis/metadata/framework.py
CHANGED
orionis/test/core/unit_test.py
CHANGED
|
@@ -10,7 +10,6 @@ from contextlib import redirect_stdout, redirect_stderr
|
|
|
10
10
|
from datetime import datetime
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from typing import Any, Dict, List, Optional, Tuple
|
|
13
|
-
from orionis.app import Orionis
|
|
14
13
|
from orionis.foundation.config.testing.enums.drivers import PersistentDrivers
|
|
15
14
|
from orionis.foundation.config.testing.enums.mode import ExecutionMode
|
|
16
15
|
from orionis.foundation.config.testing.enums.verbosity import VerbosityMode
|
|
@@ -37,7 +36,7 @@ class UnitTest(IUnitTest):
|
|
|
37
36
|
|
|
38
37
|
def __init__(
|
|
39
38
|
self,
|
|
40
|
-
app:
|
|
39
|
+
app: IApplication
|
|
41
40
|
) -> None:
|
|
42
41
|
"""
|
|
43
42
|
Initialize a UnitTest instance with default configuration and internal state.
|
|
@@ -50,7 +49,7 @@ class UnitTest(IUnitTest):
|
|
|
50
49
|
"""
|
|
51
50
|
|
|
52
51
|
# Application instance for dependency injection
|
|
53
|
-
self.__app:
|
|
52
|
+
self.__app: IApplication = app
|
|
54
53
|
|
|
55
54
|
# Storage path for test results
|
|
56
55
|
self.__storage: Optional[str] = self.__app.path('storage_testing')
|
orionis/test/kernel.py
CHANGED
|
@@ -44,7 +44,7 @@ class TestKernel(ITestKernel):
|
|
|
44
44
|
config = Testing(**app.config('testing'))
|
|
45
45
|
|
|
46
46
|
# Resolve the unit test service from the application container
|
|
47
|
-
self.__unit_test: IUnitTest = app.make('x-orionis.test.core.unit_test'
|
|
47
|
+
self.__unit_test: IUnitTest = app.make('x-orionis.test.core.unit_test')
|
|
48
48
|
|
|
49
49
|
# Apply configuration settings to the UnitTest instance
|
|
50
50
|
self.__unit_test.configure(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
orionis/app.py,sha256=b69fOzj2J8Aw5g0IldWZXixUDeeTO9vcHc_Njses9HU,603
|
|
3
3
|
orionis/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
orionis/console/kernel.py,sha256=
|
|
4
|
+
orionis/console/kernel.py,sha256=9BmGVvqWMTjyINHl5Q-oBjYT6Kmiw_EKKUkEKh5Z9N4,4487
|
|
5
5
|
orionis/console/args/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
orionis/console/args/argument.py,sha256=Is8Z8_kW4DvcK1nK1UU-sa6Pk0BeOdcRczCayW0ZVHc,20360
|
|
7
7
|
orionis/console/args/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -14,7 +14,8 @@ orionis/console/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
14
14
|
orionis/console/commands/cache.py,sha256=8DsYoRzSBLn0P9qkGVItRbo0R6snWBDBg0_Xa7tmVhs,2322
|
|
15
15
|
orionis/console/commands/help.py,sha256=ooPoenP08ArMAWiL89_oUGD9l1Faen2QjLTG90i4zCQ,3187
|
|
16
16
|
orionis/console/commands/publisher.py,sha256=FUg-EUzK7LLXsla10ZUZro8V0Z5S-KjmsaSdRHSSGbA,21381
|
|
17
|
-
orionis/console/commands/
|
|
17
|
+
orionis/console/commands/scheduler_work.py,sha256=768TntiL2dguqJ2BlMVR7zEx_xlE71CCDsZ57ZXu9As,3573
|
|
18
|
+
orionis/console/commands/test.py,sha256=_Tb-I9vabiqhqGeLfRbV5Y1LEVCdhZhBAwoEQZCzQuM,2435
|
|
18
19
|
orionis/console/commands/version.py,sha256=SUuNDJ40f2uq69OQUmPQXJKaa9Bm_iVRDPmBd7zc1Yc,3658
|
|
19
20
|
orionis/console/commands/workflow.py,sha256=NYOmjTSvm2o6AE4h9LSTZMFSYPQreNmEJtronyOxaYk,2451
|
|
20
21
|
orionis/console/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -23,7 +24,7 @@ orionis/console/contracts/kernel.py,sha256=mh4LlhEYHh3FuGZZQ0GBhD6ZLa5YQvaNj2r01
|
|
|
23
24
|
orionis/console/contracts/reactor.py,sha256=Xeq7Zrw6WE5MV_XOQfiQEchAFbb6-0TjLpjWOxYW--g,4554
|
|
24
25
|
orionis/console/contracts/schedule.py,sha256=eGjcOH7kgdf0fWDZRfOFUQsIx4E8G38ayX5JwpkpN8E,4977
|
|
25
26
|
orionis/console/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
orionis/console/core/reactor.py,sha256=
|
|
27
|
+
orionis/console/core/reactor.py,sha256=v_y3LDydBeKmtCfA0rIi8Nicy38DEfflp_zwx2OM7NQ,30257
|
|
27
28
|
orionis/console/dumper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
29
|
orionis/console/dumper/dump.py,sha256=CATERiQ6XuIrKQsDaWcVxzTtlAJI9qLJX44fQxEX8ws,22443
|
|
29
30
|
orionis/console/dumper/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -50,9 +51,10 @@ orionis/console/output/enums/__init__.py,sha256=LAaAxg-DpArCjf_jqZ0_9s3p8899gntD
|
|
|
50
51
|
orionis/console/output/enums/styles.py,sha256=6a4oQCOBOKMh2ARdeq5GlIskJ3wjiylYmh66tUKKmpQ,4053
|
|
51
52
|
orionis/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
53
|
orionis/console/tasks/event.py,sha256=NdOht_yXqKW0EIsIVrctIgOhQDWAR5fuMPEF05zTWtI,12029
|
|
53
|
-
orionis/console/tasks/
|
|
54
|
+
orionis/console/tasks/exception_report.py,sha256=IN1PCQ08ZHs1sivUpzi2f9U9eW8ydZyb8GO6KiT56LY,3643
|
|
55
|
+
orionis/console/tasks/schedule.py,sha256=yfKg0GPKEogAdndcqPJBak0NrIJ_Z-Fzpza34S-mIcc,19498
|
|
54
56
|
orionis/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
-
orionis/container/container.py,sha256=
|
|
57
|
+
orionis/container/container.py,sha256=aF_b6lTUpG4YCo9yFJEzsntTdIzgMMXFW5LyWqAJVBQ,87987
|
|
56
58
|
orionis/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
59
|
orionis/container/context/manager.py,sha256=I08K_jKXSKmrq18Pv33qYyMKIlAovVOwIgmfiVm-J7c,2971
|
|
58
60
|
orionis/container/context/scope.py,sha256=p_oCzR7dDz-5ZAd16ab4vfLc3gBf34CaN0f4iR9D0bQ,1155
|
|
@@ -69,7 +71,7 @@ orionis/container/exceptions/exception.py,sha256=goTDEwC70xTMD2qppN8KV-xyR0Nps21
|
|
|
69
71
|
orionis/container/exceptions/type.py,sha256=cYuvoXVOgRYj3tZPfK341aUERkf33-buOiI2eXxcrAw,470
|
|
70
72
|
orionis/container/exceptions/value.py,sha256=hjY0YEusoL3DurME1ornxvIv1wyGaf6tBggLFlGHblo,472
|
|
71
73
|
orionis/container/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
|
-
orionis/container/facades/facade.py,sha256=
|
|
74
|
+
orionis/container/facades/facade.py,sha256=_qoidPjtN5rPHTt9K9KpVLMVIliHlROeO0Xr_ySyzz0,3695
|
|
73
75
|
orionis/container/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
76
|
orionis/container/providers/service_provider.py,sha256=RqXpn8krFA3tt_m9CEG7-na7szp-zqfirO4DzpCHpF4,1685
|
|
75
77
|
orionis/container/validators/__init__.py,sha256=iJ_cY8U0EkpnZOU4_LANGKHFkvHeV0vH5bjbYr1fdSg,609
|
|
@@ -83,7 +85,7 @@ orionis/container/validators/is_subclass.py,sha256=4sBaGLoRs8nUhuWjlP0VJqyTwVHYq
|
|
|
83
85
|
orionis/container/validators/is_valid_alias.py,sha256=4uAYcq8xov7jZbXnpKpjNkxcZtlTNnL5RRctVPMwJes,1424
|
|
84
86
|
orionis/container/validators/lifetime.py,sha256=IQ43fDNrxYHMlZH2zlYDJnlkLO_eS4U7Fs3UJgQBidI,1844
|
|
85
87
|
orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
|
-
orionis/foundation/application.py,sha256=
|
|
88
|
+
orionis/foundation/application.py,sha256=VSTVDs366fHMWM6QIB5ABolmqA0d5yl0km9RVn-T36c,77469
|
|
87
89
|
orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
90
|
orionis/foundation/config/startup.py,sha256=vbzduprRCNyYeR2nnMaqc1uKXw6PTzAY2jVfXNQKN8I,9691
|
|
89
91
|
orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -161,7 +163,7 @@ orionis/foundation/config/queue/entities/queue.py,sha256=YiWPeEg5e0fd_DJM2ogska6
|
|
|
161
163
|
orionis/foundation/config/queue/enums/__init__.py,sha256=oWY8GWwr5mex7szs_bLVqAS1jbyuIAvKl7XFGSlU9A0,64
|
|
162
164
|
orionis/foundation/config/queue/enums/strategy.py,sha256=S_kw7KZtoCk5FTOkbuXepdy_fOl9Eav4uT2K0OyzBa0,602
|
|
163
165
|
orionis/foundation/config/roots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
164
|
-
orionis/foundation/config/roots/paths.py,sha256=
|
|
166
|
+
orionis/foundation/config/roots/paths.py,sha256=EsMHLfOejYvS_N3B2LfY-SJioHFXMUOqEo0BEiHwQAI,10675
|
|
165
167
|
orionis/foundation/config/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
166
168
|
orionis/foundation/config/session/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
167
169
|
orionis/foundation/config/session/entities/session.py,sha256=sJoD-_CiwUR88tva-rO22bagG3RTcHXrQGWbq4B5joM,5998
|
|
@@ -177,7 +179,7 @@ orionis/foundation/config/testing/enums/drivers.py,sha256=mwv47FcKDXEOxydQXAGtkd
|
|
|
177
179
|
orionis/foundation/config/testing/enums/mode.py,sha256=IbFpauu7J-iSAfmC8jDbmTEYl8eZr-AexL-lyOh8_74,337
|
|
178
180
|
orionis/foundation/config/testing/enums/verbosity.py,sha256=Z-FQ6C3rxbRwP8HoVibbgRMGcsen2SwTuEy3wnjdIhc,486
|
|
179
181
|
orionis/foundation/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
180
|
-
orionis/foundation/contracts/application.py,sha256=
|
|
182
|
+
orionis/foundation/contracts/application.py,sha256=DQbSbnlfTTPgqo6qxEoTC216_QmJ8KJRT7QBudKCoN4,27033
|
|
181
183
|
orionis/foundation/contracts/config.py,sha256=mCyA43f0n_e-CEL0f-sWWgE-M7GicS_aEtC_TNbn_yc,802
|
|
182
184
|
orionis/foundation/exceptions/__init__.py,sha256=q6we1N8kcd6j6GjUJY30WQhhHnqF9RXA0c6-ksEztlc,294
|
|
183
185
|
orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
|
|
@@ -193,10 +195,11 @@ orionis/foundation/providers/logger_provider.py,sha256=rs8UpaD_vSp3qNli0u9A4eRum
|
|
|
193
195
|
orionis/foundation/providers/performance_counter_provider.py,sha256=7y10Vaqx7GemGh2wCaww8XmdvFQXLXm9_E4GjpdNXcA,3010
|
|
194
196
|
orionis/foundation/providers/progress_bar_provider.py,sha256=X4Ke7mPr0MgVp6WDNaQ3bI3Z_LOS8qE-wid0MQErKms,3367
|
|
195
197
|
orionis/foundation/providers/reactor_provider.py,sha256=P0KQcp4AFKTrD6BStGfCTqhGUlpKgsrZTZZKSqyGJQg,3662
|
|
198
|
+
orionis/foundation/providers/scheduler_provider.py,sha256=72SoixFog9IOE9Ve9Xcfw6Zc3mmwMOiaHCH4XZr5Www,2132
|
|
196
199
|
orionis/foundation/providers/testing_provider.py,sha256=SrJRpdvcblx9WvX7x9Y3zc7OQfiTf7la0HAJrm2ESlE,3725
|
|
197
200
|
orionis/foundation/providers/workers_provider.py,sha256=oa_2NIDH6UxZrtuGkkoo_zEoNIMGgJ46vg5CCgAm7wI,3926
|
|
198
201
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
199
|
-
orionis/metadata/framework.py,sha256=
|
|
202
|
+
orionis/metadata/framework.py,sha256=2WrjUXc9K8IXUNZ9LsjyebMtSH23bttsYzs91v36bto,4109
|
|
200
203
|
orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
|
|
201
204
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
202
205
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -320,7 +323,7 @@ orionis/support/standard/exceptions/value.py,sha256=rsyWFQweImaJGTJa7Id7RhPlwWJ4
|
|
|
320
323
|
orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
|
|
321
324
|
orionis/support/wrapper/dot_dict.py,sha256=T8xWwwOhBZHNeXRwE_CxvOwG9UFxsLqNmOJjV2CNIrc,7284
|
|
322
325
|
orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
323
|
-
orionis/test/kernel.py,sha256=
|
|
326
|
+
orionis/test/kernel.py,sha256=qVEWboHxLdEaAIr9a_8qgWEVMqCEGq8VYNQP-dfEowc,6357
|
|
324
327
|
orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
325
328
|
orionis/test/cases/asynchronous.py,sha256=3e1Y3qzIxVU7i7lbLFEVyJ89IA74JsB7famx71W-p2E,1974
|
|
326
329
|
orionis/test/cases/synchronous.py,sha256=S5jhuDEZ5I9wosrTFaCtowkD5r5HzJH6mKPOdEJcDJE,1734
|
|
@@ -333,7 +336,7 @@ orionis/test/contracts/render.py,sha256=wpDQzUtT0r8KFZ7zPcxWHXQ1EVNKxzA_rZ6ZKUcZ
|
|
|
333
336
|
orionis/test/contracts/test_result.py,sha256=SNXJ2UerkweYn7uCT0i0HmMGP0XBrL_9KJs-0ZvIYU4,4002
|
|
334
337
|
orionis/test/contracts/unit_test.py,sha256=getqaBoadQT_wh_V6aTQvm0yx9IgbVrE9EEOD8b031g,8031
|
|
335
338
|
orionis/test/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
336
|
-
orionis/test/core/unit_test.py,sha256=
|
|
339
|
+
orionis/test/core/unit_test.py,sha256=ElXUoKivG7_-y834dZurJLcrEIP95t-S5TdHHq3QFP4,64761
|
|
337
340
|
orionis/test/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
338
341
|
orionis/test/entities/result.py,sha256=IMAd1AiwOf2z8krTDBFMpQe_1PG4YJ5Z0qpbr9xZwjg,4507
|
|
339
342
|
orionis/test/enums/__init__.py,sha256=M3imAgMvKFTKg55FbtVoY3zxj7QRY9AfaUWxiSZVvn4,66
|
|
@@ -367,7 +370,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
|
|
|
367
370
|
orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
|
|
368
371
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
369
372
|
orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
|
|
370
|
-
orionis-0.
|
|
373
|
+
orionis-0.481.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
|
|
371
374
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
372
375
|
tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
373
376
|
tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -497,7 +500,7 @@ tests/support/standard/test_services_std.py,sha256=I9UeUkjrDdhvfSL3ao6wx2rLysXi6
|
|
|
497
500
|
tests/support/wrapper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
498
501
|
tests/support/wrapper/test_services_wrapper_docdict.py,sha256=K-u5Z744Nj4dVie9tmLmnFxjN5vwHz_mDf6S0tZN97o,6822
|
|
499
502
|
tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
500
|
-
tests/testing/test_testing_unit.py,sha256=
|
|
503
|
+
tests/testing/test_testing_unit.py,sha256=vggKTMeDjYqoK4ykZO5ZfxN5ue9-pm-Ts5wGMrEkgXw,6906
|
|
501
504
|
tests/testing/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
502
505
|
tests/testing/cases/test_testing_asynchronous.py,sha256=3ji_jajS3bGdmMbAUQc9rBfcOTVnReklkgmAjYKL7SQ,1963
|
|
503
506
|
tests/testing/cases/test_testing_synchronous.py,sha256=Y-0teflDsL1B3nAVrGywMTY0u5a7tlAKXw9Oq1pF24M,1947
|
|
@@ -514,8 +517,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
514
517
|
tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
|
|
515
518
|
tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
516
519
|
tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
|
|
517
|
-
orionis-0.
|
|
518
|
-
orionis-0.
|
|
519
|
-
orionis-0.
|
|
520
|
-
orionis-0.
|
|
521
|
-
orionis-0.
|
|
520
|
+
orionis-0.481.0.dist-info/METADATA,sha256=7qzA9IFx_3LhMmuAN45WaCaPhPy_zMtKF-4s5BvyU3c,4801
|
|
521
|
+
orionis-0.481.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
522
|
+
orionis-0.481.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
|
523
|
+
orionis-0.481.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
524
|
+
orionis-0.481.0.dist-info/RECORD,,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import unittest
|
|
2
2
|
from unittest.mock import MagicMock
|
|
3
|
+
from orionis.app import Orionis
|
|
3
4
|
from orionis.foundation.config.testing.enums.drivers import PersistentDrivers
|
|
4
5
|
from orionis.foundation.config.testing.enums.mode import ExecutionMode
|
|
5
6
|
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
@@ -15,7 +16,7 @@ class TestTestingUnit(AsyncTestCase):
|
|
|
15
16
|
-------
|
|
16
17
|
None
|
|
17
18
|
"""
|
|
18
|
-
unit_test = UnitTest()
|
|
19
|
+
unit_test = UnitTest(Orionis())
|
|
19
20
|
# Assert that the loader is correctly initialized as a TestLoader
|
|
20
21
|
self.assertIsInstance(unit_test._UnitTest__loader, unittest.TestLoader)
|
|
21
22
|
# Assert that the suite is correctly initialized as a TestSuite
|
|
@@ -29,7 +30,7 @@ class TestTestingUnit(AsyncTestCase):
|
|
|
29
30
|
-------
|
|
30
31
|
None
|
|
31
32
|
"""
|
|
32
|
-
unit_test = UnitTest()
|
|
33
|
+
unit_test = UnitTest(Orionis())
|
|
33
34
|
# Configure the UnitTest instance with custom parameters
|
|
34
35
|
configured = unit_test.configure(
|
|
35
36
|
verbosity=1,
|
|
@@ -62,7 +63,7 @@ class TestTestingUnit(AsyncTestCase):
|
|
|
62
63
|
-------
|
|
63
64
|
None
|
|
64
65
|
"""
|
|
65
|
-
unit_test = UnitTest()
|
|
66
|
+
unit_test = UnitTest(Orionis())
|
|
66
67
|
# Create mock test cases
|
|
67
68
|
test_case1 = MagicMock()
|
|
68
69
|
test_case2 = MagicMock()
|
|
@@ -88,7 +89,7 @@ class TestTestingUnit(AsyncTestCase):
|
|
|
88
89
|
-------
|
|
89
90
|
None
|
|
90
91
|
"""
|
|
91
|
-
unit_test = UnitTest()
|
|
92
|
+
unit_test = UnitTest(Orionis())
|
|
92
93
|
# Create a combined TestResult to aggregate results into
|
|
93
94
|
combined = unittest.TestResult()
|
|
94
95
|
# Create an individual TestResult with sample data
|
|
@@ -114,7 +115,7 @@ class TestTestingUnit(AsyncTestCase):
|
|
|
114
115
|
-------
|
|
115
116
|
None
|
|
116
117
|
"""
|
|
117
|
-
unit_test = UnitTest()
|
|
118
|
+
unit_test = UnitTest(Orionis())
|
|
118
119
|
# Add a mock test case to the suite
|
|
119
120
|
mock_test = MagicMock()
|
|
120
121
|
unit_test._UnitTest__suite.addTest(mock_test)
|
|
@@ -131,7 +132,7 @@ class TestTestingUnit(AsyncTestCase):
|
|
|
131
132
|
-------
|
|
132
133
|
None
|
|
133
134
|
"""
|
|
134
|
-
unit_test = UnitTest()
|
|
135
|
+
unit_test = UnitTest(Orionis())
|
|
135
136
|
# Create a mock test case and set its id() method to return a specific identifier
|
|
136
137
|
mock_test = MagicMock()
|
|
137
138
|
mock_test.id.return_value = 'test_id'
|
|
@@ -150,7 +151,7 @@ class TestTestingUnit(AsyncTestCase):
|
|
|
150
151
|
-------
|
|
151
152
|
None
|
|
152
153
|
"""
|
|
153
|
-
unit_test = UnitTest()
|
|
154
|
+
unit_test = UnitTest(Orionis())
|
|
154
155
|
# Create two mock test cases
|
|
155
156
|
mock_test1 = MagicMock()
|
|
156
157
|
mock_test2 = MagicMock()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|