Fix code layout in tests/unit/schema/test_integration_py36.py

This commit is contained in:
Roman Mogylatov 2022-07-19 20:28:40 -04:00
parent 142b91921a
commit 0668295543
2 changed files with 54 additions and 47 deletions

View File

@ -17,6 +17,7 @@ Development
Thanks to `@illia-v (Illia Volochii) <https://github.com/illia-v>`_ for the Thanks to `@illia-v (Illia Volochii) <https://github.com/illia-v>`_ for the
PR (`#580 <https://github.com/ets-labs/python-dependency-injector/pull/580>`_). PR (`#580 <https://github.com/ets-labs/python-dependency-injector/pull/580>`_).
- Update copyright year. - Update copyright year.
- Enable skipped test ``test_schema_with_boto3_session()``.
- Update pytest configuration. - Update pytest configuration.
- Regenerate C sources using Cython 0.29.30. - Regenerate C sources using Cython 0.29.30.

View File

@ -4,7 +4,6 @@ import os
import sqlite3 import sqlite3
from dependency_injector import containers from dependency_injector import containers
from pytest import mark
from samples.schema.services import UserService, AuthService, PhotoService from samples.schema.services import UserService, AuthService, PhotoService
@ -19,7 +18,8 @@ SAMPLES_DIR = os.path.abspath(
def test_single_container_schema(container: containers.DynamicContainer): def test_single_container_schema(container: containers.DynamicContainer):
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-single.yml") container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-single.yml")
container.config.from_dict({ container.config.from_dict(
{
"database": { "database": {
"dsn": ":memory:", "dsn": ":memory:",
}, },
@ -30,7 +30,8 @@ def test_single_container_schema(container: containers.DynamicContainer):
"auth": { "auth": {
"token_ttl": 3600, "token_ttl": 3600,
}, },
}) },
)
# User service # User service
user_service1 = container.user_service() user_service1 = container.user_service()
@ -79,7 +80,8 @@ def test_single_container_schema(container: containers.DynamicContainer):
def test_multiple_containers_schema(container: containers.DynamicContainer): def test_multiple_containers_schema(container: containers.DynamicContainer):
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple.yml") container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple.yml")
container.core.config.from_dict({ container.core.config.from_dict(
{
"database": { "database": {
"dsn": ":memory:", "dsn": ":memory:",
}, },
@ -90,7 +92,8 @@ def test_multiple_containers_schema(container: containers.DynamicContainer):
"auth": { "auth": {
"token_ttl": 3600, "token_ttl": 3600,
}, },
}) },
)
# User service # User service
user_service1 = container.services.user() user_service1 = container.services.user()
@ -139,7 +142,8 @@ def test_multiple_containers_schema(container: containers.DynamicContainer):
def test_multiple_reordered_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.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-reordered.yml")
container.core.config.from_dict({ container.core.config.from_dict(
{
"database": { "database": {
"dsn": ":memory:", "dsn": ":memory:",
}, },
@ -150,7 +154,8 @@ def test_multiple_reordered_containers_schema(container: containers.DynamicConta
"auth": { "auth": {
"token_ttl": 3600, "token_ttl": 3600,
}, },
}) },
)
# User service # User service
user_service1 = container.services.user() user_service1 = container.services.user()
@ -199,7 +204,8 @@ def test_multiple_reordered_containers_schema(container: containers.DynamicConta
def test_multiple_containers_with_inline_providers_schema(container: containers.DynamicContainer): def test_multiple_containers_with_inline_providers_schema(container: containers.DynamicContainer):
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-inline.yml") container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-inline.yml")
container.core.config.from_dict({ container.core.config.from_dict(
{
"database": { "database": {
"dsn": ":memory:", "dsn": ":memory:",
}, },
@ -210,7 +216,8 @@ def test_multiple_containers_with_inline_providers_schema(container: containers.
"auth": { "auth": {
"token_ttl": 3600, "token_ttl": 3600,
}, },
}) },
)
# User service # User service
user_service1 = container.services.user() 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() 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): def test_schema_with_boto3_session(container: containers.DynamicContainer):
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-boto3-session.yml") container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-boto3-session.yml")
container.config.from_dict( container.config.from_dict(