-
Notifications
You must be signed in to change notification settings - Fork 168
Open
Description
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.
- 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
Labels
No labels