Skip to content

Commit 5f64c1a

Browse files
committed
simplify tests
1 parent b729cd2 commit 5f64c1a

2 files changed

Lines changed: 5 additions & 29 deletions

File tree

tests/conftest.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22
import secrets
33
import time
4-
from typing import Any, Generator
4+
from typing import Any
55
from unittest.mock import MagicMock
66

77
import boto3
@@ -18,16 +18,10 @@
1818
REGION_NAME: BucketLocationConstraintType = "eu-central-1"
1919

2020

21-
@pytest.fixture(scope="session")
22-
def monkeypatch_module() -> Generator[pytest.MonkeyPatch, Any, None]:
23-
with pytest.MonkeyPatch.context() as mp:
24-
yield mp
25-
26-
27-
@pytest.fixture(autouse=True, scope="function")
28-
def enqueueing_func(monkeypatch_module: pytest.MonkeyPatch) -> MagicMock:
21+
@pytest.fixture(autouse=True)
22+
def enqueueing_func(monkeypatch: pytest.MonkeyPatch) -> MagicMock:
2923
mock_enqueueing_function = MagicMock()
30-
monkeypatch_module.setitem(
24+
monkeypatch.setitem(
3125
app.dependency_overrides,
3226
enqueueing_function_dep, # type: ignore
3327
lambda: mock_enqueueing_function,

tests/integration/conftest.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
)
2929
from api.main import app
3030
from api.models import Job
31-
from tests.conftest import REGION_NAME, RDSTestingInstance, S3TestingBucket
31+
from tests.conftest import RDSTestingInstance, S3TestingBucket
3232

3333

3434
@pytest.fixture(scope="session")
@@ -109,24 +109,6 @@ def base_filesystem(
109109
) -> Generator[FileSystem, Any, None]:
110110
if env == "local":
111111
base_user_dir = f"./{base_user_dir}"
112-
113-
monkeypatch_module.setattr(
114-
settings,
115-
"user_data_root_path",
116-
base_user_dir,
117-
)
118-
monkeypatch_module.setattr(
119-
settings,
120-
"s3_region",
121-
REGION_NAME,
122-
)
123-
monkeypatch_module.setattr(
124-
settings,
125-
"filesystem",
126-
"local" if env == "local" else "s3",
127-
)
128-
129-
if env == "local":
130112
shutil.rmtree(base_user_dir, ignore_errors=True)
131113
yield LocalFilesystem(base_user_dir)
132114
shutil.rmtree(base_user_dir, ignore_errors=True)

0 commit comments

Comments
 (0)