diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 04f43f6..88506f3 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.4.2 +current_version = 3.4.3 [bumpversion:file:Makefile] search = CURRENT_VERSION = {current_version} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8360bbd..810bed9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog ========= +3.4.3 (2020-06-24) +------------------ + +* Fix Injectable failing to resolve complex/entangled imports + 3.4.2 (2020-05-22) ------------------ diff --git a/Makefile b/Makefile index c45171f..dab87b6 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ docs: make html -B cp -a build/html/. docs -CURRENT_VERSION = 3.4.2 +CURRENT_VERSION = 3.4.3 .PHONY: bump-patch-version bump-patch-version: diff --git a/README.rst b/README.rst index 63f236d..f24a167 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,8 @@ Injectable: Dependency Injection for Humans™ ============================================ +[**Examples**](https://injectable.readthedocs.io/en/latest/usage/index.html) | [**Developer Reference**](https://injectable.readthedocs.io/en/latest/reference/index.html) | [**Authors**](https://injectable.readthedocs.io/en/latest/authors.html) + .. start-badges .. list-table:: diff --git a/docs/.buildinfo b/docs/.buildinfo index e33ca6f..f2c2e84 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: d46ac49617394230bc8a148ed1d42660 +config: 81e33e91f5acc49464cf2bfb9dac9397 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_modules/index.html b/docs/_modules/index.html index ad0bdc6..b01fbad 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -3,7 +3,7 @@ - Overview: module code — injectable 3.4.2 documentation + Overview: module code — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -106,7 +106,7 @@

Navigation

diff --git a/docs/_modules/injectable/autowiring/autowired_decorator.html b/docs/_modules/injectable/autowiring/autowired_decorator.html index 5aae6a7..bcd2cb4 100644 --- a/docs/_modules/injectable/autowiring/autowired_decorator.html +++ b/docs/_modules/injectable/autowiring/autowired_decorator.html @@ -3,7 +3,7 @@ - injectable.autowiring.autowired_decorator — injectable 3.4.2 documentation + injectable.autowiring.autowired_decorator — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -173,7 +173,7 @@

Navigation

diff --git a/docs/_modules/injectable/autowiring/autowired_type.html b/docs/_modules/injectable/autowiring/autowired_type.html index 40214e7..53ec234 100644 --- a/docs/_modules/injectable/autowiring/autowired_type.html +++ b/docs/_modules/injectable/autowiring/autowired_type.html @@ -3,7 +3,7 @@ - injectable.autowiring.autowired_type — injectable 3.4.2 documentation + injectable.autowiring.autowired_type — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -236,7 +236,7 @@

Navigation

diff --git a/docs/_modules/injectable/container/injectable.html b/docs/_modules/injectable/container/injectable.html index 6d2a9b9..a318e64 100644 --- a/docs/_modules/injectable/container/injectable.html +++ b/docs/_modules/injectable/container/injectable.html @@ -3,7 +3,7 @@ - injectable.container.injectable — injectable 3.4.2 documentation + injectable.container.injectable — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -143,7 +143,7 @@

Navigation

diff --git a/docs/_modules/injectable/container/injection_container.html b/docs/_modules/injectable/container/injection_container.html index 4116646..66ed71d 100644 --- a/docs/_modules/injectable/container/injection_container.html +++ b/docs/_modules/injectable/container/injection_container.html @@ -3,7 +3,7 @@ - injectable.container.injection_container — injectable 3.4.2 documentation + injectable.container.injection_container — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -47,13 +47,12 @@

Navigation

Source code for injectable.container.injection_container

 import os
-import sys
 import warnings
-from importlib.util import module_from_spec, spec_from_file_location
+from runpy import run_path
 from typing import Dict, Optional, Callable
 from typing import Set
 
-from pycollect import PythonFileCollector, find_module_name
+from pycollect import PythonFileCollector
 
 from injectable.container.injectable import Injectable
 from injectable.container.namespace import Namespace
@@ -190,7 +189,7 @@ 

Source code for injectable.container.injection_container

if file.path in cls.LOADED_FILEPATHS: continue cls.LOADING_FILEPATH = file.path - cls._load_file(file) + run_path(file.path) cls.LOADED_FILEPATHS.add(file.path) cls.LOADING_FILEPATH = None @@ -204,7 +203,7 @@

Source code for injectable.container.injection_container

if file.path in cls.LOADED_FILEPATHS: continue cls.LOADING_FILEPATH = file.path - cls._load_file(file) + run_path(file.path) cls.LOADED_FILEPATHS.add(file.path) cls.LOADING_FILEPATH = None cls.LOADING_DEFAULT_NAMESPACE = None @@ -227,15 +226,7 @@

Source code for injectable.container.injection_container

"@injectable_factory", "injectable_factory(", ] - ) - - @classmethod - def _load_file(cls, file: os.DirEntry): - module_name = find_module_name(file) - spec = spec_from_file_location(module_name, file.path) - module = module_from_spec(spec) - sys.modules[module_name] = module - spec.loader.exec_module(module)
+ )
@@ -284,7 +275,7 @@

Navigation

diff --git a/docs/_modules/injectable/container/load_injection_container.html b/docs/_modules/injectable/container/load_injection_container.html index dfee66e..deb8079 100644 --- a/docs/_modules/injectable/container/load_injection_container.html +++ b/docs/_modules/injectable/container/load_injection_container.html @@ -3,7 +3,7 @@ - injectable.container.load_injection_container — injectable 3.4.2 documentation + injectable.container.load_injection_container — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -138,7 +138,7 @@

Navigation

diff --git a/docs/_modules/injectable/errors/autowiring_error.html b/docs/_modules/injectable/errors/autowiring_error.html index af7de5d..0b834e3 100644 --- a/docs/_modules/injectable/errors/autowiring_error.html +++ b/docs/_modules/injectable/errors/autowiring_error.html @@ -3,7 +3,7 @@ - injectable.errors.autowiring_error — injectable 3.4.2 documentation + injectable.errors.autowiring_error — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -100,7 +100,7 @@

Navigation

diff --git a/docs/_modules/injectable/errors/injection_error.html b/docs/_modules/injectable/errors/injection_error.html index dd405e9..7bee219 100644 --- a/docs/_modules/injectable/errors/injection_error.html +++ b/docs/_modules/injectable/errors/injection_error.html @@ -3,7 +3,7 @@ - injectable.errors.injection_error — injectable 3.4.2 documentation + injectable.errors.injection_error — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -100,7 +100,7 @@

Navigation

diff --git a/docs/_modules/injectable/injection/inject.html b/docs/_modules/injectable/injection/inject.html index 2c07215..7fbfccd 100644 --- a/docs/_modules/injectable/injection/inject.html +++ b/docs/_modules/injectable/injection/inject.html @@ -3,7 +3,7 @@ - injectable.injection.inject — injectable 3.4.2 documentation + injectable.injection.inject — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -267,7 +267,7 @@

Navigation

diff --git a/docs/_modules/injectable/injection/injectable_decorator.html b/docs/_modules/injectable/injection/injectable_decorator.html index 9e4d9ee..76de237 100644 --- a/docs/_modules/injectable/injection/injectable_decorator.html +++ b/docs/_modules/injectable/injection/injectable_decorator.html @@ -3,7 +3,7 @@ - injectable.injection.injectable_decorator — injectable 3.4.2 documentation + injectable.injection.injectable_decorator — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -153,7 +153,7 @@

Navigation

diff --git a/docs/_modules/injectable/injection/injectable_factory_decorator.html b/docs/_modules/injectable/injection/injectable_factory_decorator.html index 288fa59..457625a 100644 --- a/docs/_modules/injectable/injection/injectable_factory_decorator.html +++ b/docs/_modules/injectable/injection/injectable_factory_decorator.html @@ -3,7 +3,7 @@ - injectable.injection.injectable_factory_decorator — injectable 3.4.2 documentation + injectable.injection.injectable_factory_decorator — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -170,7 +170,7 @@

Navigation

diff --git a/docs/_modules/injectable/testing/clear_injectables_util.html b/docs/_modules/injectable/testing/clear_injectables_util.html index 28cbbd7..2434ada 100644 --- a/docs/_modules/injectable/testing/clear_injectables_util.html +++ b/docs/_modules/injectable/testing/clear_injectables_util.html @@ -3,7 +3,7 @@ - injectable.testing.clear_injectables_util — injectable 3.4.2 documentation + injectable.testing.clear_injectables_util — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -129,7 +129,7 @@

Navigation

diff --git a/docs/_modules/injectable/testing/register_injectables_util.html b/docs/_modules/injectable/testing/register_injectables_util.html index 072a52e..c329c27 100644 --- a/docs/_modules/injectable/testing/register_injectables_util.html +++ b/docs/_modules/injectable/testing/register_injectables_util.html @@ -3,7 +3,7 @@ - injectable.testing.register_injectables_util — injectable 3.4.2 documentation + injectable.testing.register_injectables_util — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -150,7 +150,7 @@

Navigation

diff --git a/docs/_modules/injectable/testing/reset_injection_container_util.html b/docs/_modules/injectable/testing/reset_injection_container_util.html index 5890158..9aadfa3 100644 --- a/docs/_modules/injectable/testing/reset_injection_container_util.html +++ b/docs/_modules/injectable/testing/reset_injection_container_util.html @@ -3,7 +3,7 @@ - injectable.testing.reset_injection_container_util — injectable 3.4.2 documentation + injectable.testing.reset_injection_container_util — injectable 3.4.3 documentation @@ -28,7 +28,7 @@

Navigation

@@ -113,7 +113,7 @@

Navigation

diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 21ba5bd..1b0ce2a 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '3.4.2', + VERSION: '3.4.3', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/authors.html b/docs/authors.html index 8c06b93..6bb7ebf 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -3,7 +3,7 @@ - Authors — injectable 3.4.2 documentation + Authors — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

Navigation

@@ -114,7 +114,7 @@

Navigation

diff --git a/docs/changelog.html b/docs/changelog.html index 8d5137e..8e08d6e 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -3,7 +3,7 @@ - Changelog — injectable 3.4.2 documentation + Changelog — injectable 3.4.3 documentation @@ -29,7 +29,7 @@

Navigation

@@ -48,19 +48,25 @@

Navigation

Changelog

-

3.4.2 (2020-05-22)

+

3.4.3 (2020-06-24)

-

3.4.1 (2020-05-11)

+

3.4.2 (2020-05-22)

-

3.4.0 (2020-05-09)

+

3.4.1 (2020-05-11)

+ +
+
+

3.4.0 (2020-05-09)

-
-

3.3.0 (2020-04-20)

+
+

3.3.0 (2020-04-20)

  • Include the injectable.testing utilities to ease mocking injectables.

-
-

3.2.1 (2020-04-19)

+
+

3.2.1 (2020-04-19)

  • InjectionContainer::load is more resilient against duplicated injectables

    registering

    @@ -85,32 +91,32 @@

    3.2.1 (2020-04-19) -

    3.2.0 (2020-04-15)

    +
    +

    3.2.0 (2020-04-15)

    • Support for optional injection in declarative fashion: Autowired(Optional[...])

    -
    -

    3.1.4 (2020-04-15)

    +
    +

    3.1.4 (2020-04-15)

    • Fix Autowired(List[...]) not working with qualifiers

    -
    -

    3.1.3 (2020-04-15)

    +
    +

    3.1.3 (2020-04-15)

    • Fix Windows injectables not being loaded.

    -
    -

    3.1.2 (2020-04-14)

    +
    +

    3.1.2 (2020-04-14)

    • Remove unused inspect imports.

    -
    -

    3.1.1 (2020-04-13)

    +
    +

    3.1.1 (2020-04-13)

    • Fix bug of scanning the same module more than once when InjectionContainer.load()

      is called multiple times with different relative search paths.

      @@ -119,21 +125,21 @@

      3.1.1 (2020-04-13) -

      3.1.0 (2020-04-13)

      +
      +

      3.1.0 (2020-04-13)

      • Added @injectable_factory decorator for declaring injectable factory methods

      • Include the console output in the examples

      -
      -

      3.0.1 (2020-04-13)

      +
      +

      3.0.1 (2020-04-13)

      • Fix package content missing

      -
      -

      3.0.0 (2020-04-12)

      +
      +

      3.0.0 (2020-04-12)

      • Drop support for autowiring without previous initialization of the InjectionContainer

      • Refactor @autowired decorator for working with the Autowired type annotation

      • @@ -150,21 +156,21 @@

        3.0.0 (2020-04-12) -

        2.0.0 (2018-02-24)

        +
        +

        2.0.0 (2018-02-24)

        • Drop Python 3.3 official support

        -
        -

        1.1.2 (2018-02-24)

        +
        +

        1.1.2 (2018-02-24)

        • Support for dependencies of classes without signature

        • Fix bug of builtin types not being accepted for injectable dependencies

        -
        -

        1.1.1 (2018-02-23)

        +
        +

        1.1.1 (2018-02-23)

        @@ -172,7 +173,7 @@

        Navigation

        diff --git a/docs/installation.html b/docs/installation.html index 20a2e8a..a4d0a11 100644 --- a/docs/installation.html +++ b/docs/installation.html @@ -3,7 +3,7 @@ - Installation — injectable 3.4.2 documentation + Installation — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -114,7 +114,7 @@

        Navigation

        diff --git a/docs/objects.inv b/docs/objects.inv index e786102..d31a6d5 100644 Binary files a/docs/objects.inv and b/docs/objects.inv differ diff --git a/docs/py-modindex.html b/docs/py-modindex.html index bc758f0..670071d 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -3,7 +3,7 @@ - Python Module Index — injectable 3.4.2 documentation + Python Module Index — injectable 3.4.3 documentation @@ -31,7 +31,7 @@

        Navigation

        @@ -198,7 +198,7 @@

        Navigation

        diff --git a/docs/readme.html b/docs/readme.html index f55840f..9b490ce 100644 --- a/docs/readme.html +++ b/docs/readme.html @@ -3,7 +3,7 @@ - Injectable: Dependency Injection for Humans™ — injectable 3.4.2 documentation + Injectable: Dependency Injection for Humans™ — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -48,6 +48,7 @@

        Navigation

        Injectable: Dependency Injection for Humans™

        +

        [Examples](https://injectable.readthedocs.io/en/latest/usage/index.html) | [Developer Reference](https://injectable.readthedocs.io/en/latest/reference/index.html) | [Authors](https://injectable.readthedocs.io/en/latest/authors.html)

        @@ -217,7 +218,7 @@

        Navigation

        diff --git a/docs/reference/index.html b/docs/reference/index.html index 95ca67b..ade5731 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -3,7 +3,7 @@ - Reference — injectable 3.4.2 documentation + Reference — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -124,7 +124,7 @@

        Navigation

        diff --git a/docs/reference/injectable.html b/docs/reference/injectable.html index 4529a19..f5845de 100644 --- a/docs/reference/injectable.html +++ b/docs/reference/injectable.html @@ -3,7 +3,7 @@ - injectable — injectable 3.4.2 documentation + injectable — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -499,7 +499,7 @@

        Navigation

        diff --git a/docs/reference/injectable_constants.html b/docs/reference/injectable_constants.html index 269bbf3..bb74fa0 100644 --- a/docs/reference/injectable_constants.html +++ b/docs/reference/injectable_constants.html @@ -3,7 +3,7 @@ - injectable.constants — injectable 3.4.2 documentation + injectable.constants — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -123,7 +123,7 @@

        Navigation

        diff --git a/docs/reference/injectable_errors.html b/docs/reference/injectable_errors.html index 1a51618..28b3097 100644 --- a/docs/reference/injectable_errors.html +++ b/docs/reference/injectable_errors.html @@ -3,7 +3,7 @@ - injectable.errors — injectable 3.4.2 documentation + injectable.errors — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -130,7 +130,7 @@

        Navigation

        diff --git a/docs/reference/injectable_testing.html b/docs/reference/injectable_testing.html index d859e53..2d8a123 100644 --- a/docs/reference/injectable_testing.html +++ b/docs/reference/injectable_testing.html @@ -3,7 +3,7 @@ - injectable.testing — injectable 3.4.2 documentation + injectable.testing — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -212,7 +212,7 @@

        Navigation

        diff --git a/docs/searchindex.js b/docs/searchindex.js index c27e803..748b0ab 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["authors","changelog","contributing","index","installation","readme","reference/index","reference/injectable","reference/injectable_constants","reference/injectable_errors","reference/injectable_testing","usage/TLDR","usage/basic_usage","usage/cyclic_dependency","usage/dependencies_precedence","usage/factory","usage/index","usage/injectable_mocking_for_tests","usage/injection_container_resetting_for_tests","usage/lazy_injection","usage/namespaces","usage/optional_injection","usage/qualifier_overloading","usage/singletons"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":2,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["authors.rst","changelog.rst","contributing.rst","index.rst","installation.rst","readme.rst","reference/index.rst","reference/injectable.rst","reference/injectable_constants.rst","reference/injectable_errors.rst","reference/injectable_testing.rst","usage/TLDR.rst","usage/basic_usage.rst","usage/cyclic_dependency.rst","usage/dependencies_precedence.rst","usage/factory.rst","usage/index.rst","usage/injectable_mocking_for_tests.rst","usage/injection_container_resetting_for_tests.rst","usage/lazy_injection.rst","usage/namespaces.rst","usage/optional_injection.rst","usage/qualifier_overloading.rst","usage/singletons.rst"],objects:{"":{injectable:[7,0,0,"-"]},"examples.basic_usage":{basic_usage_example:[12,0,0,"-"]},"examples.cyclic_dependency":{cyclic_dependency_example:[13,0,0,"-"]},"examples.dependencies_precedence":{dependencies_precedence_example:[14,0,0,"-"]},"examples.factory":{factory_example:[15,0,0,"-"]},"examples.injectable_mocking_for_tests":{injectable_mocking_example:[17,0,0,"-"]},"examples.injection_container_resetting_for_tests":{injection_container_resetting_example:[18,0,0,"-"]},"examples.lazy_injection":{lazy_injection_example:[19,0,0,"-"]},"examples.namespaces":{namespaces_example:[20,0,0,"-"]},"examples.optional_injection":{optional_injection_example:[21,0,0,"-"]},"examples.qualifier_overloading":{qualifier_overloading_example:[22,0,0,"-"]},"examples.singletons":{singleton_example:[23,0,0,"-"]},"examples.tldr":{tldr_example:[11,0,0,"-"]},"injectable.InjectionContainer":{load:[7,2,1,""]},"injectable.constants":{DEFAULT_NAMESPACE:[8,4,1,""]},"injectable.errors":{AutowiringError:[9,5,1,""],InjectionError:[9,5,1,""]},"injectable.testing":{clear_injectables:[10,3,1,""],register_injectables:[10,3,1,""],reset_injection_container:[10,3,1,""]},injectable:{Autowired:[7,1,1,""],Injectable:[7,1,1,""],InjectionContainer:[7,1,1,""],autowired:[7,3,1,""],constants:[8,0,0,"-"],errors:[9,0,0,"-"],inject:[7,3,1,""],inject_multiple:[7,3,1,""],injectable:[7,3,1,""],injectable_factory:[7,3,1,""],load_injection_container:[7,3,1,""],testing:[10,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"],"4":["py","data","Python data"],"5":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function","4":"py:data","5":"py:exception"},terms:{"abstract":[14,22],"break":1,"case":[2,7,15],"class":[1,5,7,10,11,12,13,14,15,17,18,19,20,21,22,23],"default":[1,7,8,10,12,19,20],"final":12,"function":[1,5,7,9,10,15,17,18],"import":[1,5,7,10,11,12,13,14,15,17,18,19,20,21,22,23],"long":10,"new":[7,10],"public":7,"return":[7,10,12,13,15,20],"static":[1,5],"true":[5,7,10,13,14,19,23],"try":18,"while":[2,19,21],Added:1,For:[3,10,11,13,16],One:7,SMS:22,The:[7,10,11,12,13,14,15,19,20,21,22],Then:20,These:5,Use:7,Will:7,__doc__:[],__init__:[5,7,11,12,13,14,15,17,19,20,21,22,23],__main__:[11,12,13,14,15,17,18,19,20,21,22,23],__name__:[11,12,13,14,15,17,18,19,20,21,22,23],_global:1,_namespac:[],_state:12,abc:[5,14,22],about:[2,22],absolut:7,abstract_servic:14,abstract_service_1:14,abstract_service_2:14,abstractmethod:[14,22],abstractservic:[7,14],accept:[1,7],access:13,action:7,actual:[5,15,19],add:[1,2,7],add_on:[],add_two:[],address:7,advantag:22,after:7,against:1,alia:[],all:[5,7,10,12,14,15,18,21,22],allrod5:0,alreadi:[7,10],also:[7,14,19,20,22],ambigu:[7,14],among:7,analysi:5,ani:[2,7,18,20,21],annot:[1,5,7,12],another_basic_servic:12,api:7,appli:7,applic:2,aren:[7,21],arg:[1,7],argument:[1,5,7,20,21],assert_cal:17,assign:[7,20],attempt:7,attribut:[13,14],author:3,auto:2,automat:[5,7],autowir:[1,5,7,9,11,12,13,14,15,17,18,19,20,21,22,23],autowiringerror:[7,9],avail:[],bar:[7,12,18,21],base:[5,7,10,14,22],basic:[3,11,16],basic_servic:12,basic_usag:12,basic_usage_exampl:12,basicservic:12,basicusag:12,befor:[7,18],behav:23,behavior:12,behaviour:[],behind:12,being:[1,7,18,19,23],beta:1,better:[2,11],between:23,black:2,bool:[7,10],both:[14,19,20,21,23],branch:2,brief:2,broker:5,bug:1,built:5,builtin:1,bunch_of_servic:21,call:[1,5,7,18,19],callabl:7,caller:[1,7],can:[1,5,7,11,13,15,17,18,19,20,23],cannot:[7,15,20],carefulli:5,chang:[1,10,23],changelog:3,check:[2,5],circular:[13,19],clarifi:2,classmethod:7,clear:[2,7,10,18],clear_inject:[10,17],client1:23,client2:23,client:15,client_endpoint:15,client_endpoint_example_env_var:15,client_factori:15,client_on:[],client_two:[],client_typ:[],clienton:[],clienttwo:[],cls:7,code:[1,2,15],collect:[7,10],com:[0,7],combin:14,command:4,comment:2,common:15,complet:12,compli:5,composite_singleton:[],compositesingleton:[],concret:22,configuration_servic:[],configurationservic:[],conflict:20,conjunct:7,connect:[15,23],consol:1,constant:[3,6,7,10],constructor:[1,7,10],contain:[3,7,10,16],content:1,contribut:3,cool:5,core:[],correct:7,counter:[],craig:0,craigminihan:0,creat:[7,22],cryptic:2,custom:[7,9],cyclic:[3,16,19],cyclic_dependency_exampl:13,cyclicdepend:13,databas:5,deal:[13,15,19],declar:[1,5,7,12,14,15,19,20,21,22,23],decor:[1,5,7,12,15],def:[5,7,11,12,13,14,15,17,18,19,20,21,22,23],default_measuring_servic:20,default_namespac:[1,7,8,10],defin:[7,10,23],demonstr:12,dep:[5,7,11,17],depend:[1,3,7,9,10,12,16,17,19,21,22,23],dependable_servic:[],dependableservic:[],dependencies_preced:14,dependencies_precedence_exampl:14,dependenciespreced:14,deprec:[1,7],descript:2,design:[5,7],detail:[13,19,20],differ:[1,5,7,14,20],direct:7,directli:7,directori:7,discourag:2,discov:5,discoveri:5,do_someth:18,doc:5,docstr:2,document:[1,2],doe:[1,7,19],doing:18,drop:1,due:7,dummi:15,duplic:[1,7],each:[12,13,14,20],earth_to_sun_dist:20,eas:[1,10],easier:13,either:7,eleg:5,elif:[],email:22,email_sender_servic:22,emailsenderservic:22,empti:[1,7,18,21],enabl:[1,13],encourag:2,end:22,endpoint:15,ensur:2,environ:1,error:[3,6,7,14,18],even_count:[],even_counter_servic:[],evencounterservic:[],everi:23,exampl:[1,2,3,7,10,11],except:[9,18],exclud:7,exclude_group:[7,22],execut:7,expect:21,explicit:14,explicitli:[7,14],expos:14,extend:5,extern:15,external_cli:15,externalcli:15,facotri:[],factori:[1,3,7,16],factory_exampl:15,fail:[1,9,14,21],fall:13,fals:[7,10,23],fashion:[1,5],favor:1,fax:22,fax_sender_servic:22,faxsenderservic:22,featur:3,feedback:2,few:5,file:[7,10,11],filter:[7,22],finish:19,first:[1,7,20],fix:1,follow:2,foo:[5,7,10,11,12,18,21],foo_factori:7,fork:2,form:2,format:2,found:[7,21],framework:[5,11,12,13,20],friendli:5,from:[1,5,7,10,11,12,13,14,15,17,18,19,20,21,22,23],func:7,func_parti:[],futur:7,gener:[1,7],get:[14,21],get_repository_st:12,get_some_property_from_a:13,get_some_property_from_b:13,getenv:15,github:0,given:[7,10],global:7,good:11,grasp:12,group:[1,7,22],guidelin:2,happen:[1,22],hard:2,has:20,have:[12,13,14,15,20],heart:5,hello:22,hint:5,how:[7,10,12,13,14,15,17,18,19,20,21,22,23],http:[0,15],human:3,idea:12,identifi:7,illustr:[12,20],illustrative_exampl:[],illustrativeexampl:11,implement:[14,22],imposs:7,includ:[1,2,18],inclus:10,independ:[12,20],index:3,indic:[7,9,14],infer:1,inform:7,init:19,initi:[1,5,7],inject:[1,3,4,6,11,12,13,14,15,16,20,22,23],inject_multipl:[1,7],injectable_factori:[1,7,15],injectable_factory_decor:15,injectable_mocking_exampl:17,injectableloaderror:7,injectablemock:17,injection_contain:[],injection_container_resetting_exampl:18,injectioncontain:[1,7],injectioncontainernotloadederror:[],injectioncontainerreset:18,injectionerror:[7,9,18,21],insid:7,inspect:1,instal:[1,3],instanc:[5,7,12,14,15,21,22,23],instanti:[1,7,13,15,19,23],instead:[1,7,12,13,14,21],internationalmeasuringservic:20,intl:20,intl_measuring_servic:20,invoc:7,invok:[7,13,19],isn:7,issu:2,its:[13,20,23],itself:[2,7],just:[5,14,21],kafkaproduc:5,keep:2,kei:[],keyerror:[],kind:2,klass:10,know:15,label:22,lambda:[10,17],last:[7,20],lazi:[1,3,5,7,13,16],lazili:19,lazy_inject:19,lazy_injection_exampl:19,lazy_object_proxi:1,lazy_servic:[],lazyinject:19,lazyservic:[],learn:[13,22],least:[7,10],level:7,leverag:19,licens:5,like:5,line:4,linter:[2,5],list:[1,5,7,21,22],load:[1,7],load_injection_contain:[1,5,7,11,12,13,14,15,17,18,19,20,21,22,23],local:[],locat:1,log:7,logic:15,look:[7,11],lookup:7,loop:13,love:3,low:7,maco:1,made:[7,18,23],magic:[2,7],mai:[2,21],main:[],make:[1,2,5,7,12,13,18],manag:7,mani:5,manual:10,map:[],mark:[1,7],martin:0,master:2,match:[7,18,22],meant:7,measuring_servic:20,messag:[5,22],message_a:[],message_b:[],message_brok:5,method:[1,7,12,13,14,19,21],mile:20,million:20,mind:2,minihan:0,minor:1,miss:1,mock:[1,3,10,16],mocked_dep:17,mocked_inject:17,mockeddep:17,model:5,modifi:13,modul:[1,3,7],more:[1,7,22],multipl:[1,7,22],multiplenamespac:[],multipleservic:14,multipli:14,multiply_servic:14,multiplyservic:14,must:7,name:1,namespac:[1,3,5,7,8,10,16,18],namespaces_exampl:20,necessari:[7,15],need:[2,7,10,19],never:7,nevertheless:2,non:7,none:[7,10,12,20,21],now:[14,15,19],odd:[],odd_count:[],odd_counter_servic:[],oddcounterservic:[],offici:1,often:2,old:22,oliveira:0,onc:[1,7,23],one:[7,10,12,13,14,17,18,20,21,23],ones:[7,20],onli:[5,7,13,19,20,23],open:2,option:[1,3,7,10,16,20],optional_injection_exampl:21,optionalinject:21,organ:2,origin:5,other:[7,11,12,13,20,22,23],otherwis:10,our:[5,12,13,14,15,19,20,21,22,23],out:[5,7,22],outermost:21,output:1,outsid:7,overload:[3,5,14,16,21],own:20,packag:[1,5],page:3,paramet:[1,5,7,10,19,20,22,23],parameter_valid:[],parameter_validation_decor:[],parameters_valid:[],parenthesi:[1,7],particular:20,pass:[5,7],path:[1,5,7],pend:5,perform:7,pip:[1,4],place:[7,23],posit:7,possibl:[1,13],preced:[3,16,22],present:[7,21],preserv:5,prevent:[7,13],previou:[1,7],previous:7,primari:[7,14,21],print:[11,12,13,14,15,17,18,19,20,21,22,23],project:[2,5],propag:[10,22],properti:[12,13],provid:[1,10],pull:2,purpos:[7,10],pycharm:5,python:[1,7,11],qualifi:[1,3,5,7,10,13,14,16,20,21],qualifier_overload:22,qualifier_overloading_exampl:22,qualifieroverload:22,quirk:1,rais:[1,7,9,10,14],readabl:2,readi:5,realdep:17,reason:[7,15],receiv:[2,7,21],recipi:22,recommend:7,record:10,recurs:10,refactor:1,refer:[3,13,19],reflect:23,regard:[7,22],regardless:7,regist:[1,7,8,10,13,18,20],register_inject:[10,17],registri:[7,20],rel:[1,7],releas:1,remov:[1,7],repositori:[2,12],repres:15,request:[2,7],requir:1,reset:[3,10,16],reset_injection_contain:[1,10,18],resili:1,resolut:[7,22],resolv:[7,14,20,21,22],respect:[7,20],respons:15,retrieve_pending_messag:5,review:2,right:19,rodrigo:0,root:[5,18],rst:[],run:[1,2,11,12,13,14,15,17,18,19,20,21,22,23],run_exampl:[11,12,13,14,15,17,18,19,20,21,22,23],runtimeerror:[],same:[1,5,7,19,22,23],satisfi:21,scan:[1,7,10],search:[1,3,7,8],search_path:7,section:[7,10,11],see:[14,15,19,20,21,23],self:[5,7,11,12,13,14,15,17,18,19,20,21,22,23],send:22,send_messag:22,send_pend:5,sender_servic:22,senderservic:22,sequenc:7,servic:[1,5,7,12,13,22],service_2:7,service_a:[13,19],service_b:[13,19],servicea:[13,19],serviceb:[13,19],set:[10,12],set_repository_st:12,setter:12,setup:7,shall:[7,21],share:[5,7,12,23],should:7,shouldn:7,show:[10,12,14,21,22],side_effect:17,signatur:1,simpl:5,simple_servic:[],simple_singleton:[],simpleservic:[],simplesingleton:[],simpli:21,sinc:[7,14],singl:[5,11,20,22],singleton:[3,5,7,12,16],singleton_cli:23,singleton_exampl:23,singletoncli:23,situat:21,sms_sender_servic:22,smssenderservic:22,some:[13,15,21],some_properti:13,some_servic:21,someth:[18,19],sourc:[7,9,10],speak:2,specif:7,specifi:[5,7,10,14,19,20],sqsproduc:5,stabl:1,start:[11,19],state:[10,12,18,23],stateful_repositori:12,statefulrepositori:12,statefulservic:12,staticmethod:17,still:7,store:7,str:[7,10,15,22],straightforward:11,string:[1,7,13],style:2,submit:2,subsect:[],success:7,successfulli:20,suit:1,suitabl:1,sum:14,sum_servic:14,sumservic:14,support:1,sure:[7,18],take:22,test:[1,2,3,5,6,7,16],testing_exampl:[],testingexampl:[],than:[1,2,7],thei:[12,19,23],them:[5,13,20],themselv:7,therefor:20,thi:[2,7,10,11,12,13,14,15,17,18,19,20,21,22,23],thoroughli:2,though:[7,14,21],three:[20,22],through:[1,15],time:[1,7,19],tldr_exampl:11,ton:1,trail:7,transpar:5,trial:1,tricki:2,turn:[12,23],two:[12,20,22,23],type:[1,5,7,10,12,20,21,22],typeerror:1,ubuntu:1,unabl:7,under:7,understand:11,union:[7,10],uniqu:7,unique_id:7,unit:[1,2],unitedstatesmeasuringservic:20,unittest:17,unknown:[],unless:10,unus:1,us_measuring_servic:20,usag:[1,3,7,10,11],use:[1,2,5,7,10,13,14,15,17,18,21,22],used:[5,7,8,20,23],using:[1,7,12,14,15,21,22],util:[1,7,10,17,18],uuid:7,valid:7,validation_parti:[],valu:[7,12,21],valueerror:10,varieti:7,version:[7,10],wai:[2,19],want:[2,21],warn:[7,18],wasn:[7,14],welcom:2,well:[2,14],were:[20,22],what:[2,20,21],when:[1,5,7,10,13,14,19,21,22,23],whenev:23,where:7,which:[1,7,10,12,13,14,15,19,21,23],whoch:[],window:1,wire:7,without:[1,7,15,20],won:[10,21],work:[1,13,19,20,21,22],world:22,would:14,wrap:[7,15,17],write:2,wrote:2,you:[2,3,11,12,13,14,15,19,20,21,22,23],your:[2,5,15]},titles:["Authors","Changelog","Contributing","Contents","Installation","Injectable: Dependency Injection for Humans\u2122","Reference","injectable","injectable.constants","injectable.errors","injectable.testing","TL;DR","Basic Usage Example","Cyclic Dependency Example","Dependencies Precedence Example","Factory Example","Usage Examples","Injectable Mocking For Tests Example","Injection Container Resetting For Tests Example","Lazy Injection Example","Namespaces Example","Optional Injection Example","Qualifier Overloading Example","Singletons Example"],titleterms:{For:[17,18],author:0,basic:12,changelog:1,constant:8,contain:18,content:3,contribut:2,cyclic:13,depend:[5,13,14],error:9,exampl:[12,13,14,15,16,17,18,19,20,21,22,23],factori:15,featur:5,human:5,illustr:[],indic:3,inject:[5,7,8,9,10,17,18,19,21],instal:4,lazi:19,love:5,mock:17,multipl:[],namespac:20,option:21,overload:22,preced:14,qualifi:22,refer:6,reset:18,singleton:23,tabl:3,test:[10,17,18],usag:[12,16],you:5}}) \ No newline at end of file +Search.setIndex({docnames:["authors","changelog","contributing","index","installation","readme","reference/index","reference/injectable","reference/injectable_constants","reference/injectable_errors","reference/injectable_testing","usage/TLDR","usage/basic_usage","usage/cyclic_dependency","usage/dependencies_precedence","usage/factory","usage/index","usage/injectable_mocking_for_tests","usage/injection_container_resetting_for_tests","usage/lazy_injection","usage/namespaces","usage/optional_injection","usage/qualifier_overloading","usage/singletons"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":2,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["authors.rst","changelog.rst","contributing.rst","index.rst","installation.rst","readme.rst","reference/index.rst","reference/injectable.rst","reference/injectable_constants.rst","reference/injectable_errors.rst","reference/injectable_testing.rst","usage/TLDR.rst","usage/basic_usage.rst","usage/cyclic_dependency.rst","usage/dependencies_precedence.rst","usage/factory.rst","usage/index.rst","usage/injectable_mocking_for_tests.rst","usage/injection_container_resetting_for_tests.rst","usage/lazy_injection.rst","usage/namespaces.rst","usage/optional_injection.rst","usage/qualifier_overloading.rst","usage/singletons.rst"],objects:{"":{injectable:[7,0,0,"-"]},"examples.basic_usage":{basic_usage_example:[12,0,0,"-"]},"examples.cyclic_dependency":{cyclic_dependency_example:[13,0,0,"-"]},"examples.dependencies_precedence":{dependencies_precedence_example:[14,0,0,"-"]},"examples.factory":{factory_example:[15,0,0,"-"]},"examples.injectable_mocking_for_tests":{injectable_mocking_example:[17,0,0,"-"]},"examples.injection_container_resetting_for_tests":{injection_container_resetting_example:[18,0,0,"-"]},"examples.lazy_injection":{lazy_injection_example:[19,0,0,"-"]},"examples.namespaces":{namespaces_example:[20,0,0,"-"]},"examples.optional_injection":{optional_injection_example:[21,0,0,"-"]},"examples.qualifier_overloading":{qualifier_overloading_example:[22,0,0,"-"]},"examples.singletons":{singleton_example:[23,0,0,"-"]},"examples.tldr":{tldr_example:[11,0,0,"-"]},"injectable.InjectionContainer":{load:[7,2,1,""]},"injectable.constants":{DEFAULT_NAMESPACE:[8,4,1,""]},"injectable.errors":{AutowiringError:[9,5,1,""],InjectionError:[9,5,1,""]},"injectable.testing":{clear_injectables:[10,3,1,""],register_injectables:[10,3,1,""],reset_injection_container:[10,3,1,""]},injectable:{Autowired:[7,1,1,""],Injectable:[7,1,1,""],InjectionContainer:[7,1,1,""],autowired:[7,3,1,""],constants:[8,0,0,"-"],errors:[9,0,0,"-"],inject:[7,3,1,""],inject_multiple:[7,3,1,""],injectable:[7,3,1,""],injectable_factory:[7,3,1,""],load_injection_container:[7,3,1,""],testing:[10,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"],"4":["py","data","Python data"],"5":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function","4":"py:data","5":"py:exception"},terms:{"abstract":[14,22],"break":1,"case":[2,7,15],"class":[1,5,7,10,11,12,13,14,15,17,18,19,20,21,22,23],"default":[1,7,8,10,12,19,20],"final":12,"function":[1,5,7,9,10,15,17,18],"import":[1,5,7,10,11,12,13,14,15,17,18,19,20,21,22,23],"long":10,"new":[7,10],"public":7,"return":[7,10,12,13,15,20],"static":[1,5],"true":[5,7,10,13,14,19,23],"try":18,"while":[2,19,21],Added:1,For:[3,10,11,13,16],One:7,SMS:22,The:[7,10,11,12,13,14,15,19,20,21,22],Then:20,These:5,Use:7,Will:7,__doc__:[],__init__:[5,7,11,12,13,14,15,17,19,20,21,22,23],__main__:[11,12,13,14,15,17,18,19,20,21,22,23],__name__:[11,12,13,14,15,17,18,19,20,21,22,23],_global:1,_namespac:[],_state:12,abc:[5,14,22],about:[2,22],absolut:7,abstract_servic:14,abstract_service_1:14,abstract_service_2:14,abstractmethod:[14,22],abstractservic:[7,14],accept:[1,7],access:13,action:7,actual:[5,15,19],add:[1,2,7],add_on:[],add_two:[],address:7,advantag:22,after:7,against:1,alia:[],all:[5,7,10,12,14,15,18,21,22],allrod5:0,alreadi:[7,10],also:[7,14,19,20,22],ambigu:[7,14],among:7,analysi:5,ani:[2,7,18,20,21],annot:[1,5,7,12],another_basic_servic:12,api:7,appli:7,applic:2,aren:[7,21],arg:[1,7],argument:[1,5,7,20,21],assert_cal:17,assign:[7,20],attempt:7,attribut:[13,14],author:[3,5],auto:2,automat:[5,7],autowir:[1,5,7,9,11,12,13,14,15,17,18,19,20,21,22,23],autowiringerror:[7,9],avail:[],bar:[7,12,18,21],base:[5,7,10,14,22],basic:[3,11,16],basic_servic:12,basic_usag:12,basic_usage_exampl:12,basicservic:12,basicusag:12,befor:[7,18],behav:23,behavior:12,behaviour:[],behind:12,being:[1,7,18,19,23],beta:1,better:[2,11],between:23,black:2,bool:[7,10],both:[14,19,20,21,23],branch:2,brief:2,broker:5,bug:1,built:5,builtin:1,bunch_of_servic:21,call:[1,5,7,18,19],callabl:7,caller:[1,7],can:[1,5,7,11,13,15,17,18,19,20,23],cannot:[7,15,20],carefulli:5,chang:[1,10,23],changelog:3,check:[2,5],circular:[13,19],clarifi:2,classmethod:7,clear:[2,7,10,18],clear_inject:[10,17],client1:23,client2:23,client:15,client_endpoint:15,client_endpoint_example_env_var:15,client_factori:15,client_on:[],client_two:[],client_typ:[],clienton:[],clienttwo:[],cls:7,code:[1,2,15],collect:[7,10],com:[0,7],combin:14,command:4,comment:2,common:15,complet:12,complex:1,compli:5,composite_singleton:[],compositesingleton:[],concret:22,configuration_servic:[],configurationservic:[],conflict:20,conjunct:7,connect:[15,23],consol:1,constant:[3,6,7,10],constructor:[1,7,10],contain:[3,7,10,16],content:1,contribut:3,cool:5,core:[],correct:7,counter:[],craig:0,craigminihan:0,creat:[7,22],cryptic:2,custom:[7,9],cyclic:[3,16,19],cyclic_dependency_exampl:13,cyclicdepend:13,databas:5,deal:[13,15,19],declar:[1,5,7,12,14,15,19,20,21,22,23],decor:[1,5,7,12,15],def:[5,7,11,12,13,14,15,17,18,19,20,21,22,23],default_measuring_servic:20,default_namespac:[1,7,8,10],defin:[7,10,23],demonstr:12,dep:[5,7,11,17],depend:[1,3,7,9,10,12,16,17,19,21,22,23],dependable_servic:[],dependableservic:[],dependencies_preced:14,dependencies_precedence_exampl:14,dependenciespreced:14,deprec:[1,7],descript:2,design:[5,7],detail:[13,19,20],develop:5,differ:[1,5,7,14,20],direct:7,directli:7,directori:7,discourag:2,discov:5,discoveri:5,do_someth:18,doc:5,docstr:2,document:[1,2],doe:[1,7,19],doing:18,drop:1,due:7,dummi:15,duplic:[1,7],each:[12,13,14,20],earth_to_sun_dist:20,eas:[1,10],easier:13,either:7,eleg:5,elif:[],email:22,email_sender_servic:22,emailsenderservic:22,empti:[1,7,18,21],enabl:[1,13],encourag:2,end:22,endpoint:15,ensur:2,entangl:1,environ:1,error:[3,6,7,14,18],even_count:[],even_counter_servic:[],evencounterservic:[],everi:23,exampl:[1,2,3,5,7,10,11],except:[9,18],exclud:7,exclude_group:[7,22],execut:7,expect:21,explicit:14,explicitli:[7,14],expos:14,extend:5,extern:15,external_cli:15,externalcli:15,facotri:[],factori:[1,3,7,16],factory_exampl:15,fail:[1,9,14,21],fall:13,fals:[7,10,23],fashion:[1,5],favor:1,fax:22,fax_sender_servic:22,faxsenderservic:22,featur:3,feedback:2,few:5,file:[7,10,11],filter:[7,22],finish:19,first:[1,7,20],fix:1,follow:2,foo:[5,7,10,11,12,18,21],foo_factori:7,fork:2,form:2,format:2,found:[7,21],framework:[5,11,12,13,20],friendli:5,from:[1,5,7,10,11,12,13,14,15,17,18,19,20,21,22,23],func:7,func_parti:[],futur:7,gener:[1,7],get:[14,21],get_repository_st:12,get_some_property_from_a:13,get_some_property_from_b:13,getenv:15,github:0,given:[7,10],global:7,good:11,grasp:12,group:[1,7,22],guidelin:2,happen:[1,22],hard:2,has:20,have:[12,13,14,15,20],heart:5,hello:22,hint:5,how:[7,10,12,13,14,15,17,18,19,20,21,22,23],html:5,http:[0,5,15],human:3,idea:12,identifi:7,illustr:[12,20],illustrative_exampl:[],illustrativeexampl:11,implement:[14,22],imposs:7,includ:[1,2,18],inclus:10,independ:[12,20],index:[3,5],indic:[7,9,14],infer:1,inform:7,init:19,initi:[1,5,7],inject:[1,3,4,6,11,12,13,14,15,16,20,22,23],inject_multipl:[1,7],injectable_factori:[1,7,15],injectable_factory_decor:15,injectable_mocking_exampl:17,injectableloaderror:7,injectablemock:17,injection_contain:[],injection_container_resetting_exampl:18,injectioncontain:[1,7],injectioncontainernotloadederror:[],injectioncontainerreset:18,injectionerror:[7,9,18,21],insid:7,inspect:1,instal:[1,3],instanc:[5,7,12,14,15,21,22,23],instanti:[1,7,13,15,19,23],instead:[1,7,12,13,14,21],internationalmeasuringservic:20,intl:20,intl_measuring_servic:20,invoc:7,invok:[7,13,19],isn:7,issu:2,its:[13,20,23],itself:[2,7],just:[5,14,21],kafkaproduc:5,keep:2,kei:[],keyerror:[],kind:2,klass:10,know:15,label:22,lambda:[10,17],last:[7,20],latest:5,lazi:[1,3,5,7,13,16],lazili:19,lazy_inject:19,lazy_injection_exampl:19,lazy_object_proxi:1,lazy_servic:[],lazyinject:19,lazyservic:[],learn:[13,22],least:[7,10],level:7,leverag:19,licens:5,like:5,line:4,linter:[2,5],list:[1,5,7,21,22],load:[1,7],load_injection_contain:[1,5,7,11,12,13,14,15,17,18,19,20,21,22,23],local:[],locat:1,log:7,logic:15,look:[7,11],lookup:7,loop:13,love:3,low:7,maco:1,made:[7,18,23],magic:[2,7],mai:[2,21],main:[],make:[1,2,5,7,12,13,18],manag:7,mani:5,manual:10,map:[],mark:[1,7],martin:0,master:2,match:[7,18,22],meant:7,measuring_servic:20,messag:[5,22],message_a:[],message_b:[],message_brok:5,method:[1,7,12,13,14,19,21],mile:20,million:20,mind:2,minihan:0,minor:1,miss:1,mock:[1,3,10,16],mocked_dep:17,mocked_inject:17,mockeddep:17,model:5,modifi:13,modul:[1,3,7],more:[1,7,22],multipl:[1,7,22],multiplenamespac:[],multipleservic:14,multipli:14,multiply_servic:14,multiplyservic:14,must:7,name:1,namespac:[1,3,5,7,8,10,16,18],namespaces_exampl:20,necessari:[7,15],need:[2,7,10,19],never:7,nevertheless:2,non:7,none:[7,10,12,20,21],now:[14,15,19],odd:[],odd_count:[],odd_counter_servic:[],oddcounterservic:[],offici:1,often:2,old:22,oliveira:0,onc:[1,7,23],one:[7,10,12,13,14,17,18,20,21,23],ones:[7,20],onli:[5,7,13,19,20,23],open:2,option:[1,3,7,10,16,20],optional_injection_exampl:21,optionalinject:21,organ:2,origin:5,other:[7,11,12,13,20,22,23],otherwis:10,our:[5,12,13,14,15,19,20,21,22,23],out:[5,7,22],outermost:21,output:1,outsid:7,overload:[3,5,14,16,21],own:20,packag:[1,5],page:3,paramet:[1,5,7,10,19,20,22,23],parameter_valid:[],parameter_validation_decor:[],parameters_valid:[],parenthesi:[1,7],particular:20,pass:[5,7],path:[1,5,7],pend:5,perform:7,pip:[1,4],place:[7,23],posit:7,possibl:[1,13],preced:[3,16,22],present:[7,21],preserv:5,prevent:[7,13],previou:[1,7],previous:7,primari:[7,14,21],print:[11,12,13,14,15,17,18,19,20,21,22,23],project:[2,5],propag:[10,22],properti:[12,13],provid:[1,10],pull:2,purpos:[7,10],pycharm:5,python:[1,7,11],qualifi:[1,3,5,7,10,13,14,16,20,21],qualifier_overload:22,qualifier_overloading_exampl:22,qualifieroverload:22,quirk:1,rais:[1,7,9,10,14],readabl:2,readi:5,readthedoc:5,realdep:17,reason:[7,15],receiv:[2,7,21],recipi:22,recommend:7,record:10,recurs:10,refactor:1,refer:[3,5,13,19],reflect:23,regard:[7,22],regardless:7,regist:[1,7,8,10,13,18,20],register_inject:[10,17],registri:[7,20],rel:[1,7],releas:1,remov:[1,7],repositori:[2,12],repres:15,request:[2,7],requir:1,reset:[3,10,16],reset_injection_contain:[1,10,18],resili:1,resolut:[7,22],resolv:[1,7,14,20,21,22],respect:[7,20],respons:15,retrieve_pending_messag:5,review:2,right:19,rodrigo:0,root:[5,18],rst:[],run:[1,2,11,12,13,14,15,17,18,19,20,21,22,23],run_exampl:[11,12,13,14,15,17,18,19,20,21,22,23],runtimeerror:[],same:[1,5,7,19,22,23],satisfi:21,scan:[1,7,10],search:[1,3,7,8],search_path:7,section:[7,10,11],see:[14,15,19,20,21,23],self:[5,7,11,12,13,14,15,17,18,19,20,21,22,23],send:22,send_messag:22,send_pend:5,sender_servic:22,senderservic:22,sequenc:7,servic:[1,5,7,12,13,22],service_2:7,service_a:[13,19],service_b:[13,19],servicea:[13,19],serviceb:[13,19],set:[10,12],set_repository_st:12,setter:12,setup:7,shall:[7,21],share:[5,7,12,23],should:7,shouldn:7,show:[10,12,14,21,22],side_effect:17,signatur:1,simpl:5,simple_servic:[],simple_singleton:[],simpleservic:[],simplesingleton:[],simpli:21,sinc:[7,14],singl:[5,11,20,22],singleton:[3,5,7,12,16],singleton_cli:23,singleton_exampl:23,singletoncli:23,situat:21,sms_sender_servic:22,smssenderservic:22,some:[13,15,21],some_properti:13,some_servic:21,someth:[18,19],sourc:[7,9,10],speak:2,specif:7,specifi:[5,7,10,14,19,20],sqsproduc:5,stabl:1,start:[11,19],state:[10,12,18,23],stateful_repositori:12,statefulrepositori:12,statefulservic:12,staticmethod:17,still:7,store:7,str:[7,10,15,22],straightforward:11,string:[1,7,13],style:2,submit:2,subsect:[],success:7,successfulli:20,suit:1,suitabl:1,sum:14,sum_servic:14,sumservic:14,support:1,sure:[7,18],take:22,test:[1,2,3,5,6,7,16],testing_exampl:[],testingexampl:[],than:[1,2,7],thei:[12,19,23],them:[5,13,20],themselv:7,therefor:20,thi:[2,7,10,11,12,13,14,15,17,18,19,20,21,22,23],thoroughli:2,though:[7,14,21],three:[20,22],through:[1,15],time:[1,7,19],tldr_exampl:11,ton:1,trail:7,transpar:5,trial:1,tricki:2,turn:[12,23],two:[12,20,22,23],type:[1,5,7,10,12,20,21,22],typeerror:1,ubuntu:1,unabl:7,under:7,understand:11,union:[7,10],uniqu:7,unique_id:7,unit:[1,2],unitedstatesmeasuringservic:20,unittest:17,unknown:[],unless:10,unus:1,us_measuring_servic:20,usag:[1,3,5,7,10,11],use:[1,2,5,7,10,13,14,15,17,18,21,22],used:[5,7,8,20,23],using:[1,7,12,14,15,21,22],util:[1,7,10,17,18],uuid:7,valid:7,validation_parti:[],valu:[7,12,21],valueerror:10,varieti:7,version:[7,10],wai:[2,19],want:[2,21],warn:[7,18],wasn:[7,14],welcom:2,well:[2,14],were:[20,22],what:[2,20,21],when:[1,5,7,10,13,14,19,21,22,23],whenev:23,where:7,which:[1,7,10,12,13,14,15,19,21,23],whoch:[],window:1,wire:7,without:[1,7,15,20],won:[10,21],work:[1,13,19,20,21,22],world:22,would:14,wrap:[7,15,17],write:2,wrote:2,you:[2,3,11,12,13,14,15,19,20,21,22,23],your:[2,5,15]},titles:["Authors","Changelog","Contributing","Contents","Installation","Injectable: Dependency Injection for Humans\u2122","Reference","injectable","injectable.constants","injectable.errors","injectable.testing","TL;DR","Basic Usage Example","Cyclic Dependency Example","Dependencies Precedence Example","Factory Example","Usage Examples","Injectable Mocking For Tests Example","Injection Container Resetting For Tests Example","Lazy Injection Example","Namespaces Example","Optional Injection Example","Qualifier Overloading Example","Singletons Example"],titleterms:{For:[17,18],author:0,basic:12,changelog:1,constant:8,contain:18,content:3,contribut:2,cyclic:13,depend:[5,13,14],error:9,exampl:[12,13,14,15,16,17,18,19,20,21,22,23],factori:15,featur:5,human:5,illustr:[],indic:3,inject:[5,7,8,9,10,17,18,19,21],instal:4,lazi:19,love:5,mock:17,multipl:[],namespac:20,option:21,overload:22,preced:14,qualifi:22,refer:6,reset:18,singleton:23,tabl:3,test:[10,17,18],usag:[12,16],you:5}}) \ No newline at end of file diff --git a/docs/usage/TLDR.html b/docs/usage/TLDR.html index 14d9eef..9159a7a 100644 --- a/docs/usage/TLDR.html +++ b/docs/usage/TLDR.html @@ -3,7 +3,7 @@ - TL;DR — injectable 3.4.2 documentation + TL;DR — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -164,7 +164,7 @@

        Navigation

        diff --git a/docs/usage/basic_usage.html b/docs/usage/basic_usage.html index aa11a87..1db5457 100644 --- a/docs/usage/basic_usage.html +++ b/docs/usage/basic_usage.html @@ -3,7 +3,7 @@ - Basic Usage Example — injectable 3.4.2 documentation + Basic Usage Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -227,7 +227,7 @@

        Navigation

        diff --git a/docs/usage/cyclic_dependency.html b/docs/usage/cyclic_dependency.html index f4f49bb..0dcd158 100644 --- a/docs/usage/cyclic_dependency.html +++ b/docs/usage/cyclic_dependency.html @@ -3,7 +3,7 @@ - Cyclic Dependency Example — injectable 3.4.2 documentation + Cyclic Dependency Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -205,7 +205,7 @@

        Navigation

        diff --git a/docs/usage/dependencies_precedence.html b/docs/usage/dependencies_precedence.html index e1512c2..2257906 100644 --- a/docs/usage/dependencies_precedence.html +++ b/docs/usage/dependencies_precedence.html @@ -3,7 +3,7 @@ - Dependencies Precedence Example — injectable 3.4.2 documentation + Dependencies Precedence Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -224,7 +224,7 @@

        Navigation

        diff --git a/docs/usage/factory.html b/docs/usage/factory.html index 00412ba..1ff0f41 100644 --- a/docs/usage/factory.html +++ b/docs/usage/factory.html @@ -3,7 +3,7 @@ - Factory Example — injectable 3.4.2 documentation + Factory Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -193,7 +193,7 @@

        Navigation

        diff --git a/docs/usage/index.html b/docs/usage/index.html index d28f179..6d89c68 100644 --- a/docs/usage/index.html +++ b/docs/usage/index.html @@ -3,7 +3,7 @@ - Usage Examples — injectable 3.4.2 documentation + Usage Examples — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -140,7 +140,7 @@

        Navigation

        diff --git a/docs/usage/injectable_mocking_for_tests.html b/docs/usage/injectable_mocking_for_tests.html index 3dfa1ea..bcd6310 100644 --- a/docs/usage/injectable_mocking_for_tests.html +++ b/docs/usage/injectable_mocking_for_tests.html @@ -3,7 +3,7 @@ - Injectable Mocking For Tests Example — injectable 3.4.2 documentation + Injectable Mocking For Tests Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -177,7 +177,7 @@

        Navigation

        diff --git a/docs/usage/injection_container_resetting_for_tests.html b/docs/usage/injection_container_resetting_for_tests.html index 157f0c7..51ba8aa 100644 --- a/docs/usage/injection_container_resetting_for_tests.html +++ b/docs/usage/injection_container_resetting_for_tests.html @@ -3,7 +3,7 @@ - Injection Container Resetting For Tests Example — injectable 3.4.2 documentation + Injection Container Resetting For Tests Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -179,7 +179,7 @@

        Navigation

        diff --git a/docs/usage/lazy_injection.html b/docs/usage/lazy_injection.html index d3a575d..832d685 100644 --- a/docs/usage/lazy_injection.html +++ b/docs/usage/lazy_injection.html @@ -3,7 +3,7 @@ - Lazy Injection Example — injectable 3.4.2 documentation + Lazy Injection Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -214,7 +214,7 @@

        Navigation

        diff --git a/docs/usage/namespaces.html b/docs/usage/namespaces.html index 6cf3316..6b755df 100644 --- a/docs/usage/namespaces.html +++ b/docs/usage/namespaces.html @@ -3,7 +3,7 @@ - Namespaces Example — injectable 3.4.2 documentation + Namespaces Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -216,7 +216,7 @@

        Navigation

        diff --git a/docs/usage/optional_injection.html b/docs/usage/optional_injection.html index f6c6f3e..086d927 100644 --- a/docs/usage/optional_injection.html +++ b/docs/usage/optional_injection.html @@ -3,7 +3,7 @@ - Optional Injection Example — injectable 3.4.2 documentation + Optional Injection Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -186,7 +186,7 @@

        Navigation

        diff --git a/docs/usage/qualifier_overloading.html b/docs/usage/qualifier_overloading.html index 443ac32..46c85e0 100644 --- a/docs/usage/qualifier_overloading.html +++ b/docs/usage/qualifier_overloading.html @@ -3,7 +3,7 @@ - Qualifier Overloading Example — injectable 3.4.2 documentation + Qualifier Overloading Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -232,7 +232,7 @@

        Navigation

        diff --git a/docs/usage/singletons.html b/docs/usage/singletons.html index 3ff080c..600608a 100644 --- a/docs/usage/singletons.html +++ b/docs/usage/singletons.html @@ -3,7 +3,7 @@ - Singletons Example — injectable 3.4.2 documentation + Singletons Example — injectable 3.4.3 documentation @@ -30,7 +30,7 @@

        Navigation

        @@ -189,7 +189,7 @@

        Navigation

        diff --git a/injectable/container/injection_container.py b/injectable/container/injection_container.py index 2f736b7..390bd3c 100644 --- a/injectable/container/injection_container.py +++ b/injectable/container/injection_container.py @@ -1,11 +1,10 @@ import os -import sys import warnings -from importlib.util import module_from_spec, spec_from_file_location +from runpy import run_path from typing import Dict, Optional, Callable from typing import Set -from pycollect import PythonFileCollector, find_module_name +from pycollect import PythonFileCollector from injectable.container.injectable import Injectable from injectable.container.namespace import Namespace @@ -142,7 +141,7 @@ def _link_dependencies(cls, search_path: str): if file.path in cls.LOADED_FILEPATHS: continue cls.LOADING_FILEPATH = file.path - cls._load_file(file) + run_path(file.path) cls.LOADED_FILEPATHS.add(file.path) cls.LOADING_FILEPATH = None @@ -156,7 +155,7 @@ def load_dependencies_from(cls, absolute_search_path: str, default_namespace: st if file.path in cls.LOADED_FILEPATHS: continue cls.LOADING_FILEPATH = file.path - cls._load_file(file) + run_path(file.path) cls.LOADED_FILEPATHS.add(file.path) cls.LOADING_FILEPATH = None cls.LOADING_DEFAULT_NAMESPACE = None @@ -180,11 +179,3 @@ def _contains_injectables(cls, file_entry: os.DirEntry) -> bool: "injectable_factory(", ] ) - - @classmethod - def _load_file(cls, file: os.DirEntry): - module_name = find_module_name(file) - spec = spec_from_file_location(module_name, file.path) - module = module_from_spec(spec) - sys.modules[module_name] = module - spec.loader.exec_module(module) diff --git a/injectable/container/load_injection_container.py b/injectable/container/load_injection_container.py index aaf5dcb..9f233ff 100644 --- a/injectable/container/load_injection_container.py +++ b/injectable/container/load_injection_container.py @@ -20,7 +20,7 @@ def load_injection_container( specific namespace. Defaults to :const:`injectable.constants.DEFAULT_NAMESPACE`. - Usage::service_2 + Usage:: >>> from injectable import load_injection_container >>> load_injection_container() diff --git a/setup.py b/setup.py index 1ae81a1..dec5e67 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def read(*names, **kwargs): setup( name="injectable", - version="3.4.2", + version="3.4.3", packages=find_packages( exclude=( "tests", diff --git a/tests/fixes/issue_30/issue_30_fix_test.py b/tests/fixes/issue_30/issue_30_fix_test.py new file mode 100644 index 0000000..9982dbd --- /dev/null +++ b/tests/fixes/issue_30/issue_30_fix_test.py @@ -0,0 +1,23 @@ +""" +Test the fix for the issue 30: +Injectable fails to resolve entangled imports +https://github.com/allrod5/injectable/issues/30 + +Injectable 3.4.2 attempted to manually import injectables into system modules. This +was causing unintended side effects. Now it just executes the injectable's files. + +This issue was fixed in injectable 3.4.3. +""" +from injectable import autowired, Autowired, load_injection_container +from injectable.testing import reset_injection_container + + +@autowired +def f(foo: Autowired("foo")): + ... + + +def test_issue_30_fix(): + reset_injection_container() + load_injection_container() + f() diff --git a/tests/fixes/issue_30/test_module/__init__.py b/tests/fixes/issue_30/test_module/__init__.py new file mode 100644 index 0000000..287a9f2 --- /dev/null +++ b/tests/fixes/issue_30/test_module/__init__.py @@ -0,0 +1,3 @@ +from tests.fixes.issue_30.test_module.foo_module import Foo + +__all__ = ["Foo"] diff --git a/tests/fixes/issue_30/test_module/foo_module/__init__.py b/tests/fixes/issue_30/test_module/foo_module/__init__.py new file mode 100644 index 0000000..f4d9569 --- /dev/null +++ b/tests/fixes/issue_30/test_module/foo_module/__init__.py @@ -0,0 +1,3 @@ +from tests.fixes.issue_30.test_module.foo_module.foo import Foo + +__all__ = ["Foo"] diff --git a/tests/fixes/issue_30/test_module/foo_module/foo.py b/tests/fixes/issue_30/test_module/foo_module/foo.py new file mode 100644 index 0000000..9052a4c --- /dev/null +++ b/tests/fixes/issue_30/test_module/foo_module/foo.py @@ -0,0 +1,8 @@ +from injectable import injectable +from tests.fixes.issue_30.test_module.utils import some_util + + +@injectable(qualifier="foo") +class Foo: + def __init__(self): + some_util.some_util() diff --git a/tests/fixes/issue_30/test_module/utils/__init__.py b/tests/fixes/issue_30/test_module/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/fixes/issue_30/test_module/utils/some_util.py b/tests/fixes/issue_30/test_module/utils/some_util.py new file mode 100644 index 0000000..bf6963c --- /dev/null +++ b/tests/fixes/issue_30/test_module/utils/some_util.py @@ -0,0 +1,2 @@ +def some_util(): + ... diff --git a/tests/fixes/issue_8/issue_8_fix_test.py b/tests/fixes/issue_8/issue_8_fix_test.py index f02ac34..8881abe 100644 --- a/tests/fixes/issue_8/issue_8_fix_test.py +++ b/tests/fixes/issue_8/issue_8_fix_test.py @@ -13,6 +13,7 @@ from typing import List from injectable import injectable, autowired, Autowired, load_injection_container +from injectable.testing import reset_injection_container @injectable(qualifier="foo") @@ -27,5 +28,6 @@ def bar(foo: Autowired(List["foo"])): def test_issue_8_fix(): + reset_injection_container() load_injection_container() bar() diff --git a/tests/unit/container/injection_container_unit_test.py b/tests/unit/container/injection_container_unit_test.py index d496fa0..d656592 100644 --- a/tests/unit/container/injection_container_unit_test.py +++ b/tests/unit/container/injection_container_unit_test.py @@ -111,17 +111,14 @@ def test__load__with_files_with_injectables( patch_open( read_data="from injectable import injectable\n@injectable\nclass A: ..." ) - patch_injection_container("find_module_name") - spec = MagicMock() - patch_injection_container("spec_from_file_location", return_value=spec) - patch_injection_container("module_from_spec") + run_path = patch_injection_container("run_path") # when InjectionContainer.load() # then assert file_collector.collect.called is True - assert spec.loader.exec_module.call_count == 2 + assert run_path.call_count == 2 def test__load__with_files_without_injectables( self, patch_injection_container, patch_open @@ -139,17 +136,14 @@ def test__load__with_files_without_injectables( "PythonFileCollector", return_value=file_collector, ) patch_open(read_data='"""not injectable"""') - patch_injection_container("find_module_name") - spec = MagicMock() - patch_injection_container("spec_from_file_location", return_value=spec) - patch_injection_container("module_from_spec") + run_path = patch_injection_container("run_path") # when InjectionContainer.load() # then assert file_collector.collect.called is True - assert spec.loader.exec_module.called is False + assert run_path.called is False def test__load__with_already_loaded_files( self, patch_injection_container, patch_open @@ -170,10 +164,7 @@ def test__load__with_already_loaded_files( patch_open( read_data="from injectable import injectable\n@injectable\nclass A: ..." ) - patch_injection_container("find_module_name") - spec = MagicMock() - patch_injection_container("spec_from_file_location", return_value=spec) - patch_injection_container("module_from_spec") + run_path = patch_injection_container("run_path") InjectionContainer.load() # when @@ -181,7 +172,7 @@ def test__load__with_already_loaded_files( # then assert file_collector.collect.call_count == 2 - assert spec.loader.exec_module.call_count == 2 + assert run_path.call_count == 2 assert len(InjectionContainer.LOADED_FILEPATHS) == 2 def test__load_dependencies_from__leaves_loading_vars_clean( @@ -232,17 +223,14 @@ def test__load_dependencies_from__with_files_with_injectables( patch_open( read_data="from injectable import injectable\n@injectable\nclass A: ..." ) - patch_injection_container("find_module_name") - spec = MagicMock() - patch_injection_container("spec_from_file_location", return_value=spec) - patch_injection_container("module_from_spec") + run_path = patch_injection_container("run_path") # when InjectionContainer.load_dependencies_from(search_path, namespace) # then assert file_collector.collect.called is True - assert spec.loader.exec_module.call_count == 2 + assert run_path.call_count == 2 def test__load_dependencies_from__with_files_without_injectables( self, patch_injection_container, patch_open @@ -260,17 +248,14 @@ def test__load_dependencies_from__with_files_without_injectables( "PythonFileCollector", return_value=file_collector, ) patch_open(read_data='"""not injectable"""') - patch_injection_container("find_module_name") - spec = MagicMock() - patch_injection_container("spec_from_file_location", return_value=spec) - patch_injection_container("module_from_spec") + run_path = patch_injection_container("run_path") # when InjectionContainer.load_dependencies_from(search_path, namespace) # then assert file_collector.collect.called is True - assert spec.loader.exec_module.called is False + assert run_path.called is False def test__load_dependencies_from__with_already_loaded_files( self, patch_injection_container, patch_open @@ -291,10 +276,7 @@ def test__load_dependencies_from__with_already_loaded_files( patch_open( read_data="from injectable import injectable\n@injectable\nclass A: ..." ) - patch_injection_container("find_module_name") - spec = MagicMock() - patch_injection_container("spec_from_file_location", return_value=spec) - patch_injection_container("module_from_spec") + run_path = patch_injection_container("run_path") InjectionContainer.load_dependencies_from(search_path, namespace) # when @@ -302,7 +284,7 @@ def test__load_dependencies_from__with_already_loaded_files( # then assert file_collector.collect.call_count == 2 - assert spec.loader.exec_module.call_count == 2 + assert run_path.call_count == 2 assert len(InjectionContainer.LOADED_FILEPATHS) == 2 def test__register_injectable__with_defaults(self, patch_injection_container):