From ff91f0bda246d3e0dccad5b52d896f92bd1f8378 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Wed, 27 Oct 2021 19:45:49 -0400 Subject: [PATCH] Update movie lister example --- examples/miniapps/movie-lister/README.rst | 12 +++++----- .../miniapps/movie-lister/movies/__main__.py | 1 - .../movie-lister/movies/containers.py | 2 +- .../miniapps/movie-lister/movies/tests.py | 23 ++++++++++--------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/miniapps/movie-lister/README.rst b/examples/miniapps/movie-lister/README.rst index 9cb0f874..1600d9e3 100644 --- a/examples/miniapps/movie-lister/README.rst +++ b/examples/miniapps/movie-lister/README.rst @@ -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% diff --git a/examples/miniapps/movie-lister/movies/__main__.py b/examples/miniapps/movie-lister/movies/__main__.py index 76671013..88df5147 100644 --- a/examples/miniapps/movie-lister/movies/__main__.py +++ b/examples/miniapps/movie-lister/movies/__main__.py @@ -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__]) diff --git a/examples/miniapps/movie-lister/movies/containers.py b/examples/miniapps/movie-lister/movies/containers.py index 9d30fbfb..889e4bb9 100644 --- a/examples/miniapps/movie-lister/movies/containers.py +++ b/examples/miniapps/movie-lister/movies/containers.py @@ -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) diff --git a/examples/miniapps/movie-lister/movies/tests.py b/examples/miniapps/movie-lister/movies/tests.py index 8caa95fb..1b29d824 100644 --- a/examples/miniapps/movie-lister/movies/tests.py +++ b/examples/miniapps/movie-lister/movies/tests.py @@ -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