Skip to content

Discussion: consider merging with statements #3

@pnijhara

Description

@pnijhara

Although the with statements mentioned below are written in tests, they can be merged. I am not very much sure about this but we can have a discussion on it.

  1. In chapter9/chapter9_db_test.py:
29 @pytest.fixture
30 async def test_client():
31    app.dependency_overrides[get_database] = get_test_database
32    async with LifespanManager(app):
33        async with httpx.AsyncClient(app=app, base_url="http://app.io") as test_client:
34            yield test_client
35
36
37 @pytest.fixture(autouse=True, scope="module")

this can reframed as:

29 @pytest.fixture
30 async def test_client():
31    app.dependency_overrides[get_database] = get_test_database
32    async with LifespanManager(app), httpx.AsyncClient(app=app, base_url="http://app.io") as test_client:
33        yield test_client
34
35
36 @pytest.fixture(autouse=True, scope="module")

Similarly in chapter9/chapter9_app_post_test.py, chapter9/chapter9_app_test.py, chapter9/chapter9_db_test.py. There could be other collapsable with statements that could be merged that I haven't looked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions