Update flask-blueprints example

This commit is contained in:
Roman Mogylatov 2021-10-27 21:29:06 -04:00
parent 17be5f9365
commit 2ce4a1c6b9
3 changed files with 17 additions and 16 deletions

View File

@ -81,20 +81,21 @@ The output should be something like:
.. code-block:: .. code-block::
platform darwin -- Python 3.9, pytest-5.4.3, py-1.9.0, pluggy-0.13.1 platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
plugins: flask-1.0.0, cov-2.10.0 plugins: cov-3.0.0, flask-1.2.0
collected 2 items collected 2 items
githubnavigator/tests.py .. [100%] githubnavigator/tests.py .. [100%]
---------- coverage: platform darwin, python 3.9 ----------- ---------- coverage: platform darwin, python 3.10.0-final-0 ----------
Name Stmts Miss Cover Name Stmts Miss Cover
---------------------------------------------------- ------------------------------------------------------------
githubnavigator/__init__.py 0 0 100% githubnavigator/__init__.py 0 0 100%
githubnavigator/application.py 15 0 100% githubnavigator/application.py 13 0 100%
githubnavigator/blueprints/__init__.py 0 0 100%
githubnavigator/blueprints/example.py 12 0 100% githubnavigator/blueprints/example.py 12 0 100%
githubnavigator/containers.py 7 0 100% githubnavigator/containers.py 8 0 100%
githubnavigator/services.py 14 0 100% githubnavigator/services.py 14 0 100%
githubnavigator/tests.py 34 0 100% githubnavigator/tests.py 34 0 100%
----------------------------------------------------------- ------------------------------------------------------------
TOTAL 82 0 100% TOTAL 81 0 100%

View File

@ -9,9 +9,7 @@ from .blueprints import example
def create_app() -> Flask: def create_app() -> Flask:
container = Container() container = Container()
container.config.from_yaml("config.yml")
container.config.github.auth_token.from_env("GITHUB_TOKEN") container.config.github.auth_token.from_env("GITHUB_TOKEN")
container.wire(modules=[example])
app = Flask(__name__) app = Flask(__name__)
app.container = container app.container = container

View File

@ -8,7 +8,9 @@ from . import services
class Container(containers.DeclarativeContainer): class Container(containers.DeclarativeContainer):
config = providers.Configuration() wiring_config = containers.WiringConfiguration(packages=[".blueprints"])
config = providers.Configuration(yaml_files=["config.yml"])
github_client = providers.Factory( github_client = providers.Factory(
Github, Github,