mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-24 18:43:58 +03:00
Update movie lister example
This commit is contained in:
parent
da636171de
commit
ff91f0bda2
|
@ -58,21 +58,21 @@ The output should be something like:
|
|||
|
||||
.. code-block::
|
||||
|
||||
platform darwin -- Python 3.9, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
|
||||
plugins: cov-2.10.0
|
||||
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
|
||||
plugins: cov-3.0.0
|
||||
collected 2 items
|
||||
|
||||
movies/tests.py .. [100%]
|
||||
|
||||
---------- coverage: platform darwin, python 3.9 -----------
|
||||
---------- coverage: platform darwin, python 3.10 -----------
|
||||
Name Stmts Miss Cover
|
||||
------------------------------------------
|
||||
movies/__init__.py 0 0 100%
|
||||
movies/__main__.py 18 18 0%
|
||||
movies/__main__.py 16 16 0%
|
||||
movies/containers.py 9 0 100%
|
||||
movies/entities.py 7 1 86%
|
||||
movies/finders.py 26 13 50%
|
||||
movies/listers.py 8 0 100%
|
||||
movies/tests.py 24 0 100%
|
||||
movies/tests.py 23 0 100%
|
||||
------------------------------------------
|
||||
TOTAL 92 32 65%
|
||||
TOTAL 89 30 66%
|
||||
|
|
|
@ -19,7 +19,6 @@ def main(lister: MovieLister = Provide[Container.lister]) -> None:
|
|||
|
||||
if __name__ == "__main__":
|
||||
container = Container()
|
||||
container.config.from_yaml("config.yml")
|
||||
container.config.finder.type.from_env("MOVIE_FINDER_TYPE")
|
||||
container.wire(modules=[__name__])
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from . import finders, listers, entities
|
|||
|
||||
class Container(containers.DeclarativeContainer):
|
||||
|
||||
config = providers.Configuration()
|
||||
config = providers.Configuration(yaml_files=["config.yml"])
|
||||
|
||||
movie = providers.Factory(entities.Movie)
|
||||
|
||||
|
|
|
@ -9,19 +9,20 @@ from .containers import Container
|
|||
|
||||
@pytest.fixture
|
||||
def container():
|
||||
container = Container()
|
||||
container.config.from_dict({
|
||||
"finder": {
|
||||
"type": "csv",
|
||||
"csv": {
|
||||
"path": "/fake-movies.csv",
|
||||
"delimiter": ",",
|
||||
},
|
||||
"sqlite": {
|
||||
"path": "/fake-movies.db",
|
||||
container = Container(
|
||||
config={
|
||||
"finder": {
|
||||
"type": "csv",
|
||||
"csv": {
|
||||
"path": "/fake-movies.csv",
|
||||
"delimiter": ",",
|
||||
},
|
||||
"sqlite": {
|
||||
"path": "/fake-movies.db",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
)
|
||||
return container
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user