orionis 0.589.0__py3-none-any.whl → 0.590.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.
@@ -850,7 +850,8 @@ class Reactor(IReactor):
850
850
  output = self.__app.call(command_instance, command.method)
851
851
 
852
852
  # Calculate elapsed time and log completion with DONE state if command.timestamps are enabled
853
- elapsed_time = round(self.__performance_counter.stop(), 2)
853
+ self.__performance_counter.stop()
854
+ elapsed_time = round(self.__performance_counter.getSeconds(), 2)
854
855
  if command.timestamps:
855
856
  self.__executer.done(program=signature, time=f"{elapsed_time}s")
856
857
 
@@ -866,7 +867,8 @@ class Reactor(IReactor):
866
867
  self.__logger.error(f"Command '{signature}' execution failed: {e}")
867
868
 
868
869
  # Calculate elapsed time and log failure with ERROR state if command.timestamps are enabled
869
- elapsed_time = round(self.__performance_counter.stop(), 2)
870
+ self.__performance_counter.stop()
871
+ elapsed_time = round(self.__performance_counter.getSeconds(), 2)
870
872
  if command.timestamps:
871
873
  self.__executer.fail(program=signature, time=f"{elapsed_time}s")
872
874
 
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.589.0"
8
+ VERSION = "0.590.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -9,7 +9,7 @@ class IPerformanceCounter(ABC):
9
9
  """
10
10
 
11
11
  @abstractmethod
12
- def start(self) -> float:
12
+ def start(self) -> 'IPerformanceCounter':
13
13
  """
14
14
  Start the performance counter.
15
15
 
@@ -18,13 +18,13 @@ class IPerformanceCounter(ABC):
18
18
 
19
19
  Returns
20
20
  -------
21
- float
22
- The timestamp (in fractional seconds) at which the counter was started.
21
+ IPerformanceCounter
22
+ The instance of the performance counter for method chaining.
23
23
  """
24
24
  pass
25
25
 
26
26
  @abstractmethod
27
- def stop(self) -> float:
27
+ def stop(self) -> 'IPerformanceCounter':
28
28
  """
29
29
  Stop the performance counter and calculate the elapsed time.
30
30
 
@@ -32,9 +32,106 @@ class IPerformanceCounter(ABC):
32
32
  the elapsed time since `start()` was called. The elapsed time is the
33
33
  difference between the end and start timestamps.
34
34
 
35
+ Returns
36
+ -------
37
+ IPerformanceCounter
38
+ The instance of the performance counter for method chaining.
39
+ """
40
+ pass
41
+
42
+ @abstractmethod
43
+ def elapsedTime(self) -> float:
44
+ """
45
+ Get the elapsed time between the last start and stop calls.
46
+
47
+ This method returns the elapsed time calculated during the last
48
+ `stop()` call. If the counter has not been started and stopped,
49
+ it raises an exception.
50
+
51
+ Returns
52
+ -------
53
+ float
54
+ The elapsed time in seconds (as a float) between the last `start()` and `stop()` calls.
55
+
56
+ Raises
57
+ ------
58
+ ValueError
59
+ If the counter has not been started and stopped properly.
60
+ """
61
+ pass
62
+
63
+ @abstractmethod
64
+ def getMicroseconds(self) -> float:
65
+ """
66
+ Get the elapsed time in microseconds.
67
+
68
+ This method returns the elapsed time in microseconds by converting
69
+ the value obtained from `elapsedTime()`.
70
+
71
+ Returns
72
+ -------
73
+ float
74
+ The elapsed time in microseconds (as a float).
75
+ """
76
+ pass
77
+
78
+ @abstractmethod
79
+ def getMilliseconds(self) -> float:
80
+ """
81
+ Get the elapsed time in milliseconds.
82
+
83
+ This method returns the elapsed time in milliseconds by converting
84
+ the value obtained from `elapsedTime()`.
85
+
86
+ Returns
87
+ -------
88
+ float
89
+ The elapsed time in milliseconds (as a float).
90
+ """
91
+ pass
92
+
93
+ @abstractmethod
94
+ def getSeconds(self) -> float:
95
+ """
96
+ Get the elapsed time in seconds.
97
+
98
+ This method returns the elapsed time in seconds, which is the same
99
+ value as obtained from `elapsedTime()`.
100
+
101
+ Returns
102
+ -------
103
+ float
104
+ The elapsed time in seconds (as a float).
105
+ """
106
+ pass
107
+
108
+ @abstractmethod
109
+ def getMinutes(self) -> float:
110
+ """
111
+ Get the elapsed time in minutes.
112
+
113
+ This method returns the elapsed time in minutes by converting
114
+ the value obtained from `elapsedTime()`.
115
+
116
+ Returns
117
+ -------
118
+ float
119
+ The elapsed time in minutes (as a float).
120
+ """
121
+ pass
122
+
123
+ @abstractmethod
124
+ def restart(self) -> float:
125
+ """
126
+ Restart the performance counter.
127
+
128
+ This method resets the start and end times to None and starts the counter again.
129
+ It is useful for measuring a new interval without creating a new instance of
130
+ PerformanceCounter.
131
+
35
132
  Returns
36
133
  -------
37
134
  float
38
- The elapsed time in seconds (as a float) between when `start()` and `stop()` were called.
135
+ The timestamp (in fractional seconds) at which the counter was restarted.
39
136
  """
40
137
  pass
@@ -49,7 +49,10 @@ class PerformanceCounter(IPerformanceCounter):
49
49
  # Time when the counter is stopped; initialized to None
50
50
  self.__end_time = None
51
51
 
52
- def start(self) -> float:
52
+ # Difference between end time and start time; initialized to None
53
+ self.__diff_time = None
54
+
55
+ def start(self) -> 'PerformanceCounter':
53
56
  """
54
57
  Start the performance counter.
55
58
 
@@ -58,15 +61,15 @@ class PerformanceCounter(IPerformanceCounter):
58
61
 
59
62
  Returns
60
63
  -------
61
- float
62
- The timestamp (in fractional seconds) at which the counter was started.
64
+ IPerformanceCounter
65
+ The instance of the performance counter for method chaining.
63
66
  """
64
67
 
65
68
  # Record the current time as the start time
66
69
  self.__start_time = time.perf_counter()
67
- return self.__start_time
70
+ return self
68
71
 
69
- def stop(self) -> float:
72
+ def stop(self) -> 'PerformanceCounter':
70
73
  """
71
74
  Stop the performance counter and calculate the elapsed time.
72
75
 
@@ -76,12 +79,119 @@ class PerformanceCounter(IPerformanceCounter):
76
79
 
77
80
  Returns
78
81
  -------
79
- float
80
- The elapsed time in seconds (as a float) between when `start()` and `stop()` were called.
82
+ IPerformanceCounter
83
+ The instance of the performance counter for method chaining.
81
84
  """
82
85
 
83
86
  # Record the current time as the end time
84
87
  self.__end_time = time.perf_counter()
85
88
 
86
89
  # Calculate and return the elapsed time
87
- return self.__end_time - self.__start_time
90
+ self.__diff_time = self.__end_time - self.__start_time
91
+ return self
92
+
93
+ def elapsedTime(self) -> float:
94
+ """
95
+ Get the elapsed time between the last start and stop calls.
96
+
97
+ This method returns the elapsed time calculated during the last
98
+ `stop()` call. If the counter has not been started and stopped,
99
+ it raises an exception.
100
+
101
+ Returns
102
+ -------
103
+ float
104
+ The elapsed time in seconds (as a float) between the last `start()` and `stop()` calls.
105
+
106
+ Raises
107
+ ------
108
+ ValueError
109
+ If the counter has not been started and stopped properly.
110
+ """
111
+
112
+ if self.__diff_time is None:
113
+ raise ValueError("Counter has not been started and stopped properly.")
114
+
115
+ return self.__diff_time
116
+
117
+ def getMicroseconds(self) -> float:
118
+ """
119
+ Get the elapsed time in microseconds.
120
+
121
+ This method returns the elapsed time in microseconds by converting
122
+ the value obtained from `elapsedTime()`.
123
+
124
+ Returns
125
+ -------
126
+ float
127
+ The elapsed time in microseconds (as a float).
128
+ """
129
+
130
+ return self.elapsedTime() * 1_000_000
131
+
132
+ def getMilliseconds(self) -> float:
133
+ """
134
+ Get the elapsed time in milliseconds.
135
+
136
+ This method returns the elapsed time in milliseconds by converting
137
+ the value obtained from `elapsedTime()`.
138
+
139
+ Returns
140
+ -------
141
+ float
142
+ The elapsed time in milliseconds (as a float).
143
+ """
144
+
145
+ return self.elapsedTime() * 1_000
146
+
147
+ def getSeconds(self) -> float:
148
+ """
149
+ Get the elapsed time in seconds.
150
+
151
+ This method returns the elapsed time in seconds, which is the same
152
+ value as obtained from `elapsedTime()`.
153
+
154
+ Returns
155
+ -------
156
+ float
157
+ The elapsed time in seconds (as a float).
158
+ """
159
+
160
+ return self.elapsedTime()
161
+
162
+ def getMinutes(self) -> float:
163
+ """
164
+ Get the elapsed time in minutes.
165
+
166
+ This method returns the elapsed time in minutes by converting
167
+ the value obtained from `elapsedTime()`.
168
+
169
+ Returns
170
+ -------
171
+ float
172
+ The elapsed time in minutes (as a float).
173
+ """
174
+
175
+ return self.elapsedTime() / 60
176
+
177
+ def restart(self) -> float:
178
+ """
179
+ Restart the performance counter.
180
+
181
+ This method resets the start and end times to None and starts the counter again.
182
+ It is useful for measuring a new interval without creating a new instance of
183
+ PerformanceCounter.
184
+
185
+ Returns
186
+ -------
187
+ float
188
+ The timestamp (in fractional seconds) at which the counter was restarted.
189
+ """
190
+
191
+ # Reset start and end times
192
+ self.__start_time = None
193
+ self.__end_time = None
194
+ self.__diff_time = None
195
+
196
+ # Start the counter again
197
+ return self.start()
@@ -17,6 +17,7 @@ from orionis.foundation.config.testing.enums.drivers import PersistentDrivers
17
17
  from orionis.foundation.config.testing.enums.mode import ExecutionMode
18
18
  from orionis.foundation.contracts.application import IApplication
19
19
  from orionis.services.introspection.instances.reflection import ReflectionInstance
20
+ from orionis.support.performance.contracts.counter import IPerformanceCounter
20
21
  from orionis.test.contracts.test_result import IOrionisTestResult
21
22
  from orionis.test.contracts.unit_test import IUnitTest
22
23
  from orionis.test.entities.result import TestResult
@@ -384,7 +385,10 @@ class UnitTest(IUnitTest):
384
385
  - Provides detailed error messages for failed imports and missing tests.
385
386
  """
386
387
  try:
388
+
389
+ # Iterate through all imported test modules
387
390
  for test_module in self.__modules:
391
+
388
392
  # Load all tests from the current module
389
393
  module_suite = self.__loader.loadTestsFromModule(test_module)
390
394
 
@@ -454,7 +458,8 @@ class UnitTest(IUnitTest):
454
458
  )
455
459
 
456
460
  def run(
457
- self
461
+ self,
462
+ performance_counter: IPerformanceCounter
458
463
  ) -> Dict[str, Any]:
459
464
  """
460
465
  Execute the test suite and return a summary of the results.
@@ -470,16 +475,15 @@ class UnitTest(IUnitTest):
470
475
  If the test suite execution fails and throw_exception is True.
471
476
  """
472
477
 
478
+ # Record the start time in seconds
479
+ performance_counter.start()
480
+
473
481
  # Length of all tests in the suite
474
482
  total_tests = len(list(self.__flattenTestSuite(self.__suite)))
475
483
 
476
484
  # If no tests are found, print a message and return early
477
485
  if total_tests == 0:
478
- self.__printer.zeroTestsMessage()
479
- return
480
-
481
- # Record the start time in nanoseconds
482
- start_time = time.time_ns()
486
+ return self.__printer.zeroTestsMessage()
483
487
 
484
488
  # Print the start message with test suite details
485
489
  self.__printer.startMessage(
@@ -499,7 +503,8 @@ class UnitTest(IUnitTest):
499
503
  self.__error_buffer = error_buffer.getvalue()
500
504
 
501
505
  # Calculate execution time in milliseconds
502
- execution_time = (time.time_ns() - start_time) / 1_000_000_000
506
+ performance_counter.stop()
507
+ execution_time = performance_counter.getSeconds()
503
508
 
504
509
  # Generate a summary of the test results
505
510
  summary = self.__generateSummary(result, execution_time)
orionis/test/kernel.py CHANGED
@@ -69,7 +69,7 @@ class TestKernel(ITestKernel):
69
69
  """
70
70
 
71
71
  # Run the unit test suite and collect the output summary
72
- output = self.__unit_test.run()
72
+ output = self.__app.call(self.__unit_test, 'run')
73
73
 
74
74
  # Only log detailed report if output is available
75
75
  if output is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.589.0
3
+ Version: 0.590.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
@@ -32,7 +32,7 @@ orionis/console/contracts/reactor.py,sha256=iT6ShoCutAWEeJzOf_PK7CGXi9TgrOD5tewH
32
32
  orionis/console/contracts/schedule.py,sha256=N-AYUa1CJY7a4CV9L1EX_EUDtGlDJMg4y0aV9EDby1Q,16090
33
33
  orionis/console/contracts/schedule_event_listener.py,sha256=h06qsBxuEMD3KLSyu0JXdUDHlQW19BX9lA09Qrh2QXg,3818
34
34
  orionis/console/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- orionis/console/core/reactor.py,sha256=-Yf7EIrohU-2gnxJfqRvuhD49ITef64CKMECiTCx0eQ,43108
35
+ orionis/console/core/reactor.py,sha256=AjusZMznUmrfIlUWlFGPaTNZi5fQ2FHCedQOmgHetfM,43222
36
36
  orionis/console/dumper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  orionis/console/dumper/debug.py,sha256=p8uflSXeDJDrVM9mZY4JMYEus73Z6TsLnQQtgP0QUak,22427
38
38
  orionis/console/dynamic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -217,7 +217,7 @@ orionis/foundation/providers/scheduler_provider.py,sha256=irwkjMiq-HpsbJxAOnhjji
217
217
  orionis/foundation/providers/testing_provider.py,sha256=2akFnabtH_cV_7z_2cCL7u8cPCGvCJAmlhMcnlCrc4c,3742
218
218
  orionis/foundation/providers/workers_provider.py,sha256=P_YtJuPNrdJAQJkAqI11KI0c6GSB9NqIuuCKpRytE0g,3937
219
219
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
220
- orionis/metadata/framework.py,sha256=txjk_25DYSonM4bVEfG0F3hPxtu46pq9X86ix4aIOyQ,4109
220
+ orionis/metadata/framework.py,sha256=7Qamg4AASaPxTO8Is_Gn8xfzZKI92BhuKTIvZSGHSPU,4109
221
221
  orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
222
222
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
223
223
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -347,9 +347,9 @@ orionis/support/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
347
347
  orionis/support/patterns/singleton/__init__.py,sha256=BIyMYL5yXpzv_F-jsSEtoKYseGlM8jdJT8hwGuXZZl8,62
348
348
  orionis/support/patterns/singleton/meta.py,sha256=TmrE-QlkglBChD4bmMgQRGT3nli6Kf6UvDl1tiEjQ_o,3801
349
349
  orionis/support/performance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
350
- orionis/support/performance/counter.py,sha256=eTr1VoFy1Jiqc4lmyhrYGTe2ge-Vpl1zuzYt_3nMTP8,2947
350
+ orionis/support/performance/counter.py,sha256=-IyrsnJKTq3H3J2O0vmTUsuZTeduLlkyvFNDPqUnRiY,6055
351
351
  orionis/support/performance/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
352
- orionis/support/performance/contracts/counter.py,sha256=uDBFk4YswAI4O72t2lc2H8Ck86WU4tp8p4gPXg-r3mw,1317
352
+ orionis/support/performance/contracts/counter.py,sha256=JK-ZOzC4emxxz5wGgpOJZuoTGOZawU2b06rTyGjosgc,3971
353
353
  orionis/support/standard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
354
354
  orionis/support/standard/std.py,sha256=zwXOellgGy9LTmeAK-rCIr7CgKYg5iQijMjdwmMblFA,3800
355
355
  orionis/support/standard/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -359,7 +359,7 @@ orionis/support/standard/exceptions/standard.py,sha256=BM0VHLRYD7SzoMJkaA7BxY528
359
359
  orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
360
360
  orionis/support/wrapper/dot_dict.py,sha256=T8xWwwOhBZHNeXRwE_CxvOwG9UFxsLqNmOJjV2CNIrc,7284
361
361
  orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
362
- orionis/test/kernel.py,sha256=6yvS0vQBuZ5M2wH2DzTMSRA-judzCK1fnnzkmLfw49w,3970
362
+ orionis/test/kernel.py,sha256=omGCyj45ES4T5YhC7WVya21oR64O3ymiTgwq1d7mDUE,3988
363
363
  orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
364
364
  orionis/test/cases/asynchronous.py,sha256=3e1Y3qzIxVU7i7lbLFEVyJ89IA74JsB7famx71W-p2E,1974
365
365
  orionis/test/cases/synchronous.py,sha256=S5jhuDEZ5I9wosrTFaCtowkD5r5HzJH6mKPOdEJcDJE,1734
@@ -372,7 +372,7 @@ orionis/test/contracts/render.py,sha256=wpDQzUtT0r8KFZ7zPcxWHXQ1EVNKxzA_rZ6ZKUcZ
372
372
  orionis/test/contracts/test_result.py,sha256=SNXJ2UerkweYn7uCT0i0HmMGP0XBrL_9KJs-0ZvIYU4,4002
373
373
  orionis/test/contracts/unit_test.py,sha256=hOuMgm1JVk3ERLrpMnDhShMWCJCJBdgOsY-U6kPaO0k,2335
374
374
  orionis/test/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
375
- orionis/test/core/unit_test.py,sha256=mge6EZvfSeZKxSGo6k0-5putfvEByRF-IDAFx-9aSNY,64908
375
+ orionis/test/core/unit_test.py,sha256=Yqn_Q-aM0-x2zzsnB-h3XBGg20iCrn1pkT1UFI-L0RE,65105
376
376
  orionis/test/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
377
377
  orionis/test/entities/result.py,sha256=eZ6UIqGmFW8FZ9x8PB_MZbLAc-SAuUyi4FUcMYIZzGo,4777
378
378
  orionis/test/enums/__init__.py,sha256=M3imAgMvKFTKg55FbtVoY3zxj7QRY9AfaUWxiSZVvn4,66
@@ -406,8 +406,8 @@ orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnI
406
406
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
407
407
  orionis/test/view/render.py,sha256=1FJHFBRHbwI5FV90F9-cMUmT10xrA5tc2bY1ysTzD-8,4094
408
408
  orionis/test/view/report.stub,sha256=QLqqCdRoENr3ECiritRB3DO_MOjRQvgBh5jxZ3Hs1r0,28189
409
- orionis-0.589.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
410
- orionis-0.589.0.dist-info/METADATA,sha256=1tRDA0nH_HAgPvPbBNK0ZywbkcihrZRHkLU-pxDRHPE,4801
411
- orionis-0.589.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
412
- orionis-0.589.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
413
- orionis-0.589.0.dist-info/RECORD,,
409
+ orionis-0.590.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
410
+ orionis-0.590.0.dist-info/METADATA,sha256=tCJPLPBw0Lyfjjn3RITEIgrYYOuSjgV7ung6ipxijr8,4801
411
+ orionis-0.590.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
412
+ orionis-0.590.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
413
+ orionis-0.590.0.dist-info/RECORD,,