Arises from: ral-facilities/ldap-jwt-auth#283
Unless a scope is specified for a pytest fixture, it means that it is created and destroyed in each test. The above PR sets the scope of the fixture_test_client fixture to package so that FastAPI's TestClient object can be created before any e2e tests are run and destroyed after all the tests run. We have the same fixture in this project that will need updating but it's also worth reviewing other fixtures while at it.
|
@pytest.fixture(name="test_client") |
|
def fixture_test_client() -> TestClient: |
|
""" |
|
Fixture for creating a test client for the application. |
|
|
|
:return: The test client. |
|
""" |
|
return TestClient(app, headers={"Authorization": f"Bearer {VALID_ACCESS_TOKEN}"}) |
Arises from: ral-facilities/ldap-jwt-auth#283
Unless a scope is specified for a pytest fixture, it means that it is created and destroyed in each test. The above PR sets the scope of the
fixture_test_clientfixture topackageso that FastAPI'sTestClientobject can be created before any e2e tests are run and destroyed after all the tests run. We have the same fixture in this project that will need updating but it's also worth reviewing other fixtures while at it.object-storage-api/test/e2e/conftest.py
Lines 18 to 25 in 0bda737