Skip to content

Commit 62dd84a

Browse files
committed
package-scoped fixtures to have correct cleanup
1 parent 4e3ee60 commit 62dd84a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

tests/integration/conftest.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@
1818
from workerfacing_api.main import workerfacing_app
1919

2020

21-
@pytest.fixture(scope="session")
21+
@pytest.fixture(scope="package")
2222
def test_username() -> str:
2323
return "test_user"
2424

2525

26-
@pytest.fixture(scope="session")
26+
@pytest.fixture(scope="package")
2727
def base_dir() -> str:
2828
return "int_test_dir"
2929

3030

31-
@pytest.fixture(scope="session")
31+
@pytest.fixture(scope="package")
3232
def internal_api_key_secret() -> str:
3333
return "test_internal_api_key"
3434

3535

3636
@pytest.fixture(
37-
scope="session",
37+
scope="package",
3838
params=["local", pytest.param("aws", marks=pytest.mark.aws)],
3939
)
4040
def env(
@@ -52,7 +52,7 @@ def env(
5252
s3_testing_bucket.cleanup()
5353

5454

55-
@pytest.fixture(scope="session")
55+
@pytest.fixture(scope="package")
5656
def base_filesystem(
5757
env: str,
5858
base_dir: str,
@@ -89,7 +89,7 @@ def base_filesystem(
8989
raise NotImplementedError
9090

9191

92-
@pytest.fixture(scope="session")
92+
@pytest.fixture(scope="package")
9393
def queue(
9494
env: str,
9595
rds_testing_instance: RDSTestingInstance,
@@ -106,7 +106,7 @@ def queue(
106106
queue.delete()
107107

108108

109-
@pytest.fixture(scope="session", autouse=True)
109+
@pytest.fixture(scope="package", autouse=True)
110110
def override_filesystem_dep(
111111
base_filesystem: FileSystem, monkeypatch_module: pytest.MonkeyPatch
112112
) -> None:
@@ -117,7 +117,7 @@ def override_filesystem_dep(
117117
)
118118

119119

120-
@pytest.fixture(scope="session", autouse=True)
120+
@pytest.fixture(scope="package", autouse=True)
121121
def override_queue_dep(
122122
queue: RDSJobQueue, monkeypatch_module: pytest.MonkeyPatch
123123
) -> None:
@@ -128,7 +128,7 @@ def override_queue_dep(
128128
)
129129

130130

131-
@pytest.fixture(scope="session", autouse=True)
131+
@pytest.fixture(scope="package", autouse=True)
132132
def override_auth(monkeypatch_module: pytest.MonkeyPatch, test_username: str) -> None:
133133
monkeypatch_module.setitem(
134134
workerfacing_app.dependency_overrides, # type: ignore
@@ -143,7 +143,7 @@ def override_auth(monkeypatch_module: pytest.MonkeyPatch, test_username: str) ->
143143
)
144144

145145

146-
@pytest.fixture(scope="session", autouse=True)
146+
@pytest.fixture(scope="package", autouse=True)
147147
def override_internal_api_key_secret(
148148
monkeypatch_module: pytest.MonkeyPatch, internal_api_key_secret: str
149149
) -> str:

tests/integration/endpoints/test_jobs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828
from workerfacing_api.schemas.rds_models import JobStates
2929

3030

31-
@pytest.fixture(scope="session")
31+
@pytest.fixture(scope="package")
3232
def app() -> AppSpecs:
3333
return AppSpecs(cmd=["cmd"], env={"env": "var"})
3434

3535

36-
@pytest.fixture(scope="session")
36+
@pytest.fixture(scope="package")
3737
def handler() -> HandlerSpecs:
3838
return HandlerSpecs(image_url="u", files_up={"output": "out"})
3939

4040

41-
@pytest.fixture(scope="session")
41+
@pytest.fixture(scope="package")
4242
def paths_upload(
4343
env: str, test_username: str, base_filesystem: FileSystem
4444
) -> PathsUploadSpecs:
@@ -56,7 +56,7 @@ def paths_upload(
5656
class TestJobs(_TestEndpoint):
5757
endpoint = "/jobs"
5858

59-
@pytest.fixture(scope="session")
59+
@pytest.fixture(scope="package")
6060
def passing_params(self) -> list[EndpointParams]:
6161
return [EndpointParams("get", params={"memory": 1})]
6262

0 commit comments

Comments
 (0)