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
PR (`#580 <https://github.com/ets-labs/python-dependency-injector/pull/580>`_).
- Update copyright year.
- Enable skipped test ``test_schema_with_boto3_session()``.
- Update pytest configuration.
- Regenerate C sources using Cython 0.29.30.

View File

@ -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,7 +18,8 @@ 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({
container.config.from_dict(
{
"database": {
"dsn": ":memory:",
},
@ -30,7 +30,8 @@ def test_single_container_schema(container: containers.DynamicContainer):
"auth": {
"token_ttl": 3600,
},
})
},
)
# 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):
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple.yml")
container.core.config.from_dict({
container.core.config.from_dict(
{
"database": {
"dsn": ":memory:",
},
@ -90,7 +92,8 @@ def test_multiple_containers_schema(container: containers.DynamicContainer):
"auth": {
"token_ttl": 3600,
},
})
},
)
# User service
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):
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-reordered.yml")
container.core.config.from_dict({
container.core.config.from_dict(
{
"database": {
"dsn": ":memory:",
},
@ -150,7 +154,8 @@ def test_multiple_reordered_containers_schema(container: containers.DynamicConta
"auth": {
"token_ttl": 3600,
},
})
},
)
# User service
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):
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-inline.yml")
container.core.config.from_dict({
container.core.config.from_dict(
{
"database": {
"dsn": ":memory:",
},
@ -210,7 +216,8 @@ def test_multiple_containers_with_inline_providers_schema(container: containers.
"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(