orionis 0.379.0__py3-none-any.whl → 0.380.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.
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.379.0"
8
+ VERSION = "0.380.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -10,8 +10,11 @@ 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.container.resolver.resolver import Resolver
13
14
  from orionis.foundation.contracts.application import IApplication
15
+ from orionis.services.introspection.concretes.reflection import ReflectionConcrete
14
16
  from orionis.services.introspection.instances.reflection import ReflectionInstance
17
+ from orionis.services.introspection.dependencies.entities.known_dependencies import KnownDependency
15
18
  from orionis.services.system.workers import Workers
16
19
  from orionis.test.entities.result import TestResult
17
20
  from orionis.test.enums import (
@@ -686,57 +689,119 @@ class UnitTest(IUnitTest):
686
689
  passed, failed, and skipped tests.
687
690
  """
688
691
 
689
- # Flatten the suite to avoid duplicate tests
690
- flattened_suite = unittest.TestSuite(self.__flattenTestSuite(self.suite))
691
-
692
692
  # Create a new test suite with tests that have their dependencies resolved
693
693
  flattened_suite = unittest.TestSuite()
694
- app = self.app
695
-
694
+
696
695
  # Iterate through all test cases
697
696
  for test_case in self.__flattenTestSuite(self.suite):
697
+
698
698
  # Get the test method name
699
- method_name = getattr(test_case, '_testMethodName', None)
700
-
701
- # Skip if we can't identify the test method
699
+ method_name = ReflectionInstance(test_case).getAttribute("_testMethodName")
700
+
701
+ # Is not method_name, use the original test case
702
702
  if not method_name:
703
703
  flattened_suite.addTest(test_case)
704
704
  continue
705
-
705
+
706
+ # Get the actual method object
707
+ test_method = getattr(test_case.__class__, method_name, None)
708
+
709
+ # Check for all decorators on the test method
710
+ decorators = []
711
+
712
+ # Get decorators from the test method
713
+ if hasattr(test_method, '__wrapped__'):
714
+ original = test_method
715
+ while hasattr(original, '__wrapped__'):
716
+ # Try to get decorator name
717
+ if hasattr(original, '__qualname__'):
718
+ decorators.append(original.__qualname__)
719
+ elif hasattr(original, '__name__'):
720
+ decorators.append(original.__name__)
721
+ original = original.__wrapped__
722
+
723
+ # If use decorators, use original test method
724
+ if decorators:
725
+ flattened_suite.addTest(test_case)
726
+ continue
727
+
706
728
  # Extract dependencies for the test method
707
- rsv = ReflectionInstance(test_case).getMethodDependencies(method_name)
708
-
729
+ signature = ReflectionInstance(test_case).getMethodDependencies(method_name)
730
+
709
731
  # If no dependencies to resolve, just add the original test
710
- if not rsv.resolved and not rsv.unresolved:
732
+ if (not signature.resolved and not signature.unresolved) or \
733
+ (not signature.resolved and len(signature.unresolved) > 0):
711
734
  flattened_suite.addTest(test_case)
712
735
  continue
713
-
736
+
737
+ # If there are unresolved dependencies, raise an error
738
+ if (len(signature.unresolved) > 0):
739
+ raise OrionisTestValueError(
740
+ f"Test method '{method_name}' in class '{test_case.__class__.__name__}' has unresolved dependencies: {signature.unresolved}. "
741
+ "Please ensure all dependencies are correctly defined and available."
742
+ )
743
+
714
744
  # Create a specialized test case with resolved dependencies
715
- test_class = test_case.__class__
745
+ test_class = ReflectionInstance(test_case).getClass()
716
746
  original_method = getattr(test_class, method_name)
717
-
747
+
718
748
  # Create a dict of resolved dependencies
719
- args_ = {}
720
- for k, v in rsv.resolved.items():
721
- from orionis.services.introspection.dependencies.entities.known_dependencies import KnownDependency
722
- if isinstance(v, KnownDependency):
723
- args_[k] = app.make(v.type)
724
-
749
+ params = {}
750
+ resolve = Resolver(self.app)
751
+ for key, value in signature.resolved.items():
752
+
753
+ # If the dependency is a KnownDependency, resolve it
754
+ if isinstance(value, KnownDependency):
755
+
756
+ # If the dependency is a built-in type, raise an exception
757
+ if value.module_name == 'builtins':
758
+ raise OrionisTestValueError(
759
+ f"Cannot resolve built-in type '{value.type.__name__}' for dependency '{key}' in test method '{method_name}'. "
760
+ "Built-in types cannot be resolved by the container."
761
+ )
762
+
763
+ # Try to resolve from container using type (Abstract or Interface)
764
+ if self.app.bound(value.type):
765
+ params[key] = resolve.resolve(
766
+ self.app.getBinding(value.type)
767
+ )
768
+
769
+ # Try to resolve from container using full class path
770
+ elif self.app.bound(value.full_class_path):
771
+ params[key] = resolve.resolve(
772
+ self.app.getBinding(value.full_class_path)
773
+ )
774
+
775
+ # Try to instantiate directly if it's a concrete class
776
+ elif ReflectionConcrete.isConcreteClass(value.type):
777
+ params[key] = value.type(**resolve._Resolver__resolveDependencies(value.type, is_class=True))
778
+
779
+ # Try to call directly if it's a callable
780
+ elif callable(value.type) and not isinstance(value.type, type):
781
+ params[key] = value.type(**self._Resolver__resolveDependencies(value.type, is_class=False))
782
+
783
+ # If the dependency cannot be resolved, raise an exception
784
+ else:
785
+ raise OrionisTestValueError(
786
+ f"Cannot resolve dependency '{key}' of type '{value.type.__name__}' in test method '{method_name}'. "
787
+ "Ensure that the dependency is bound in the container or is a concrete class."
788
+ )
789
+ else:
790
+ # Use default value
791
+ params[key] = value
792
+
725
793
  # Create a wrapper method that injects dependencies
726
- def create_test_wrapper(original_test, resolved_args, unresolved_args):
794
+ def create_test_wrapper(original_test, resolved_args:dict):
727
795
  def wrapper(self_instance):
728
- args_list = list(resolved_args.values())
729
- args_list.extend(unresolved_args)
730
- return original_test(self_instance, *args_list)
796
+ return original_test(self_instance, **resolved_args)
731
797
  return wrapper
732
-
798
+
733
799
  # Create a new test case with the wrapped method
734
- setattr(test_class, f"_wrapped_{method_name}", create_test_wrapper(original_method, args_, rsv.unresolved))
800
+ setattr(test_class, f"_wrapped_{method_name}", create_test_wrapper(original_method, params))
735
801
  setattr(test_case, '_testMethodName', f"_wrapped_{method_name}")
736
-
802
+
737
803
  # Add the modified test case to the suite
738
804
  flattened_suite.addTest(test_case)
739
- # sys.exit(0)
740
805
 
741
806
  # Create a custom result class to capture detailed test results
742
807
  with redirect_stdout(output_buffer), redirect_stderr(error_buffer):
orionis/test/kernel.py CHANGED
@@ -277,7 +277,10 @@ class TestKernel(ITestKernel):
277
277
  throw_exception = bool(args.throw_exception),
278
278
  persistent = bool(args.persistent),
279
279
  persistent_driver = str(args.persistent_driver) if args.persistent_driver else None,
280
- web_report = bool(args.web_report)
280
+ web_report = bool(args.web_report),
281
+ folder_path=[
282
+ 'example'
283
+ ]
281
284
  )
282
285
 
283
286
  # If requested, print the output buffer
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.379.0
3
+ Version: 0.380.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
@@ -247,7 +247,7 @@ orionis/foundation/providers/path_resolver_provider.py,sha256=rXvaVc5sSqmDgRzWJo
247
247
  orionis/foundation/providers/progress_bar_provider.py,sha256=75Jr4iEgUOUGl8Di1DioeP5_HRQlR-1lVzPmS96sWjA,737
248
248
  orionis/foundation/providers/workers_provider.py,sha256=WWlji3C69_-Y0c42aZDbR_bmcE_qZEh2SaA_cNkCivI,702
249
249
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
250
- orionis/metadata/framework.py,sha256=yiHJEhUKMoCW7Ln8C4NYk5K8x74wxPDOrKS-AP7Osqg,4960
250
+ orionis/metadata/framework.py,sha256=N6gwACmEpQ02LMBnzQ75QQVdUNjZoEI8mWGUqgy94q4,4960
251
251
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
252
252
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
253
253
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -349,7 +349,7 @@ orionis/support/standard/exceptions/value.py,sha256=7xry_TZz3k-BLAZTR_uDiQ0RfXOk
349
349
  orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
350
350
  orionis/support/wrapper/dot_dict.py,sha256=VdAUH-DO6y86pl_9N6v-vU9mdLraWh5HjVzI5iC1dMs,5295
351
351
  orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
352
- orionis/test/kernel.py,sha256=_dzms3-5IuDNIE_JjaexwaoZhkHNvU-aAUEwOVtW8sc,13337
352
+ orionis/test/kernel.py,sha256=O_gNZwGkKJnaRZdVAd1z22MI-n-Q6LyWtQPujpyXNvw,13407
353
353
  orionis/test/arguments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
354
354
  orionis/test/arguments/parser.py,sha256=Oz09NCbQ9JrJgviiPJ92WbRa54rXWCsr6RDzPoh05vE,6019
355
355
  orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -364,7 +364,7 @@ orionis/test/contracts/printer.py,sha256=FcTii6uglVIfvsgbmG0lj3hv1RGmDWuDo0eo4Z8
364
364
  orionis/test/contracts/render.py,sha256=0o6NjrKx2ewBf1JvAf8BaAtJQPb64yq1FJCeKb3iXys,967
365
365
  orionis/test/contracts/unit_test.py,sha256=pEceAVTJGb1ohEiiMD8X3YKT6xUsRECpB0ZO9K-RUWU,8383
366
366
  orionis/test/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
367
- orionis/test/core/unit_test.py,sha256=wZU4PuTjWKaEUpVXaFd-n3mWC_B68EvFHtzwMsF-c_g,55743
367
+ orionis/test/core/unit_test.py,sha256=LA46wkU2dogXDVEX2xydrhUTC7vuFoVLSdemPVgLAHk,59117
368
368
  orionis/test/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
369
369
  orionis/test/entities/arguments.py,sha256=V7HT-yaXzQR5m9E8AcJST2vQ4DGd7E0ks1swkRN_v6E,1394
370
370
  orionis/test/entities/result.py,sha256=8HRLg32bRLZX8NWgsGimJbSG8aX6n0VpbUEG57ClTGo,3023
@@ -385,10 +385,10 @@ orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
385
385
  orionis/test/records/logs.py,sha256=EOQcloMVdhlNl2lU9igQz8H4b-OtKtiwh2pgr_QZWOI,13186
386
386
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
387
387
  orionis/test/view/render.py,sha256=zd7xDvVfmQ2HxZamDTzL2-z2PpyL99EaolbbM7wTah4,5014
388
- orionis-0.379.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
388
+ orionis-0.380.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
389
389
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
390
390
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
391
- tests/example/test_example.py,sha256=xNhEg6qMvljIcE17H0ovuMns7a1d0u883t60Jlg7E94,682
391
+ tests/example/test_example.py,sha256=hmfAaYU2lPsjO9teUiXcdmeRlBrF33rhaVbiYD3VPs0,944
392
392
  tests/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
393
393
  tests/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
394
394
  tests/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -486,8 +486,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=nTNrvJkMSPx_aopEQ9
486
486
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
487
487
  tests/testing/test_testing_result.py,sha256=fnH7hjumNSErAFGITJgq2LHxSzvPF2tdtmHL9kyAv-Y,4409
488
488
  tests/testing/test_testing_unit.py,sha256=d3CRGo6608fMzYcZKIKapjx_af2aigqWiKSiuK9euIY,7600
489
- orionis-0.379.0.dist-info/METADATA,sha256=ZRb1unbFNV7f6hge0iuRxvcSdT_c4TiXAXwA25rpKNk,4772
490
- orionis-0.379.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
491
- orionis-0.379.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
492
- orionis-0.379.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
493
- orionis-0.379.0.dist-info/RECORD,,
489
+ orionis-0.380.0.dist-info/METADATA,sha256=MzNtBUHGw4xdvmc1qdxZxLAbY8P6dxMjm5wltWUVRDI,4772
490
+ orionis-0.380.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
491
+ orionis-0.380.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
492
+ orionis-0.380.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
493
+ orionis-0.380.0.dist-info/RECORD,,
@@ -1,3 +1,5 @@
1
+ from unittest.mock import patch
2
+ from orionis.console.output.console import Console
1
3
  from orionis.console.output.contracts.console import IConsole
2
4
  from orionis.test.cases.synchronous import SyncTestCase
3
5
 
@@ -6,7 +8,9 @@ class TestExample(SyncTestCase):
6
8
  Unit tests for basic example functionality.
7
9
  """
8
10
 
9
- def testUnitExample(self) -> None:
11
+ # @patch('orionis.console.output.contracts.console.IConsole', autospec=True)
12
+ # @patch('orionis.console.output.contracts.console.IConsole', autospec=True)
13
+ def testUnitExample(self, cos:Console) -> None:
10
14
  """
11
15
  Test that basic equality assertions work as expected.
12
16