Skip to content

Commit f8325c0

Browse files
committed
test: fix fixture dir discovery
1 parent 88dbe97 commit f8325c0

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎tests/conftest.py‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@ def __call__(
3838

3939

4040
@pytest.fixture(scope="session")
41-
def root_dir() -> Path:
41+
def fixtures_dir() -> Path:
4242
root_dir = Path(__file__).parent.resolve()
4343

44-
while root_dir.name != "async-geotiff":
44+
while root_dir != Path("/") and not (root_dir / "fixtures").exists():
4545
root_dir = root_dir.parent
4646

47-
return root_dir
47+
if not (root_dir / "fixtures").exists():
48+
raise RuntimeError("Couldn't find the fixtures dir")
49+
return root_dir / "fixtures"
4850

4951

5052
@pytest.fixture(scope="session")
51-
def fixture_store(root_dir) -> LocalStore:
52-
return LocalStore(root_dir / "fixtures")
53+
def fixture_store(fixtures_dir) -> LocalStore:
54+
return LocalStore(fixtures_dir)
5355

5456

5557
@pytest.fixture
@@ -69,7 +71,7 @@ async def _load(name: str, *, variant: str = "rasterio") -> GeoTIFF:
6971

7072

7173
@pytest.fixture
72-
def load_rasterio(root_dir):
74+
def load_rasterio(fixtures_dir):
7375
@contextmanager
7476
def _load(
7577
name: str,
@@ -78,7 +80,7 @@ def _load(
7880
OVERVIEW_LEVEL: int | None = None, # noqa: N803
7981
**kwargs: Any, # noqa: ANN401
8082
) -> Generator[DatasetReader, None, None]:
81-
path = f"{root_dir}/fixtures/geotiff-test-data/"
83+
path = f"{fixtures_dir}/geotiff-test-data/"
8284
if variant == "rasterio":
8385
path += "rasterio_generated/fixtures/"
8486
else:

0 commit comments

Comments
 (0)