From 0668295543dd3aa89bef63e5dd23caf6b82090a4 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Tue, 19 Jul 2022 20:28:40 -0400 Subject: [PATCH] Fix code layout in tests/unit/schema/test_integration_py36.py --- docs/main/changelog.rst | 1 + tests/unit/schema/test_integration_py36.py | 100 +++++++++++---------- 2 files changed, 54 insertions(+), 47 deletions(-) diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 973ccec9..8ed6a343 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -17,6 +17,7 @@ Development Thanks to `@illia-v (Illia Volochii) `_ for the PR (`#580 `_). - Update copyright year. +- Enable skipped test ``test_schema_with_boto3_session()``. - Update pytest configuration. - Regenerate C sources using Cython 0.29.30. diff --git a/tests/unit/schema/test_integration_py36.py b/tests/unit/schema/test_integration_py36.py index aa7a6fd0..702f93e1 100644 --- a/tests/unit/schema/test_integration_py36.py +++ b/tests/unit/schema/test_integration_py36.py @@ -4,7 +4,6 @@ import os import sqlite3 from dependency_injector import containers -from pytest import mark from samples.schema.services import UserService, AuthService, PhotoService @@ -19,18 +18,20 @@ SAMPLES_DIR = os.path.abspath( def test_single_container_schema(container: containers.DynamicContainer): container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-single.yml") - container.config.from_dict({ - "database": { - "dsn": ":memory:", - }, - "aws": { - "access_key_id": "KEY", - "secret_access_key": "SECRET", - }, - "auth": { - "token_ttl": 3600, - }, - }) + container.config.from_dict( + { + "database": { + "dsn": ":memory:", + }, + "aws": { + "access_key_id": "KEY", + "secret_access_key": "SECRET", + }, + "auth": { + "token_ttl": 3600, + }, + }, + ) # User service user_service1 = container.user_service() @@ -79,18 +80,20 @@ def test_single_container_schema(container: containers.DynamicContainer): def test_multiple_containers_schema(container: containers.DynamicContainer): container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple.yml") - container.core.config.from_dict({ - "database": { - "dsn": ":memory:", + container.core.config.from_dict( + { + "database": { + "dsn": ":memory:", + }, + "aws": { + "access_key_id": "KEY", + "secret_access_key": "SECRET", + }, + "auth": { + "token_ttl": 3600, + }, }, - "aws": { - "access_key_id": "KEY", - "secret_access_key": "SECRET", - }, - "auth": { - "token_ttl": 3600, - }, - }) + ) # User service user_service1 = container.services.user() @@ -139,18 +142,20 @@ def test_multiple_containers_schema(container: containers.DynamicContainer): def test_multiple_reordered_containers_schema(container: containers.DynamicContainer): container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-reordered.yml") - container.core.config.from_dict({ - "database": { - "dsn": ":memory:", + container.core.config.from_dict( + { + "database": { + "dsn": ":memory:", + }, + "aws": { + "access_key_id": "KEY", + "secret_access_key": "SECRET", + }, + "auth": { + "token_ttl": 3600, + }, }, - "aws": { - "access_key_id": "KEY", - "secret_access_key": "SECRET", - }, - "auth": { - "token_ttl": 3600, - }, - }) + ) # User service user_service1 = container.services.user() @@ -199,18 +204,20 @@ def test_multiple_reordered_containers_schema(container: containers.DynamicConta def test_multiple_containers_with_inline_providers_schema(container: containers.DynamicContainer): container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-inline.yml") - container.core.config.from_dict({ - "database": { - "dsn": ":memory:", + container.core.config.from_dict( + { + "database": { + "dsn": ":memory:", + }, + "aws": { + "access_key_id": "KEY", + "secret_access_key": "SECRET", + }, + "auth": { + "token_ttl": 3600, + }, }, - "aws": { - "access_key_id": "KEY", - "secret_access_key": "SECRET", - }, - "auth": { - "token_ttl": 3600, - }, - }) + ) # User service user_service1 = container.services.user() @@ -257,7 +264,6 @@ def test_multiple_containers_with_inline_providers_schema(container: containers. assert photo_service2.s3 is container.gateways.s3_client() -@mark.skip(reason="Boto3 tries to connect to the internet") def test_schema_with_boto3_session(container: containers.DynamicContainer): container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-boto3-session.yml") container.config.from_dict(