diff --git a/.github/workflows/run_all.yml b/.github/workflows/run_all.yml index 7251d75..6706aeb 100644 --- a/.github/workflows/run_all.yml +++ b/.github/workflows/run_all.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 @@ -22,11 +22,13 @@ jobs: pip install poetry poetry install - name: Lint + if: matrix.python-version == '3.11' run: | poetry run ruff --format=github wireup - name: Check formatting + if: matrix.python-version == '3.11' run: | poetry run black --check . - name: Run tests run: | - python -m unittest discover -s test/ \ No newline at end of file + python -m unittest discover -s test/ diff --git a/wireup/ioc/dependency_container.py b/wireup/ioc/dependency_container.py index 5ddd1f0..5ef1405 100644 --- a/wireup/ioc/dependency_container.py +++ b/wireup/ioc/dependency_container.py @@ -201,7 +201,8 @@ def __callable_get_params_to_inject(self, fn: Callable[..., Any], klass: type[__ values_from_parameters = {} for name, parameter in inspect.signature(fn).parameters.items(): - if obj := self.__get_container_dependency_or_param(parameter): + obj = self.__get_container_dependency_or_param(parameter) + if obj: values_from_parameters[name] = obj args = {**params_from_context, **values_from_parameters} @@ -217,8 +218,9 @@ def __get(self, klass: type[__T], qualifier: ContainerProxyQualifierValue) -> __ self.__assert_dependency_exists(klass, qualifier) class_to_initialize = klass - if klass in self.__known_interfaces: # noqa: SIM102 - if concrete_class := self.__get_concrete_class_from_interface_and_qualifier(klass, qualifier): + if self.__is_interface_known(klass): + concrete_class = self.__get_concrete_class_from_interface_and_qualifier(klass, qualifier) + if concrete_class: class_to_initialize = concrete_class if self.__is_impl_known_from_factory(class_to_initialize):