Skip to content

Commit

Permalink
Use session-scoped pytest fixture for TestClients
Browse files Browse the repository at this point in the history
#5
5ba0726

Adding `scope="session"` ensures the FastAPI and Starlette TestClients
are only created once per testing session.
  • Loading branch information
br3ndonland committed Aug 31, 2020
1 parent 5b9706f commit 397638e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def basic_auth(
return username, password


@pytest.fixture
@pytest.fixture(scope="session")
def clients() -> List[TestClient]:
"""Instantiate test client classes."""
return [TestClient(fastapi_app), TestClient(starlette_app)]
Expand Down

0 comments on commit 397638e

Please sign in to comment.