Skip to content

Commit d46b032

Browse files
committed
Use per-test temp files in test fixtures
The `filepath_h5mu`/`filepath_hdf5` fixtures were module-scoped, so a shared file path was reused across tests. Under the template's parallel test runner (`pytest -n auto`) two workers wrote the same HDF5 file and collided (`BlockingIOError: unable to lock file`). Scope them per function with unique `tmp_path` files instead.
1 parent 1762501 commit d46b032

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import scanpy as sc # type: ignore[import-untyped]
33

44

5-
@pytest.fixture(scope="module")
6-
def filepath_h5mu(tmpdir_factory):
7-
yield str(tmpdir_factory.mktemp("tmp_test_dir").join("test.h5mu"))
5+
@pytest.fixture
6+
def filepath_h5mu(tmp_path):
7+
yield str(tmp_path / "test.h5mu")
88

99

10-
@pytest.fixture(scope="module")
11-
def filepath_hdf5(tmpdir_factory):
12-
yield str(tmpdir_factory.mktemp("tmp_mofa_dir").join("mofa_pytest.hdf5"))
10+
@pytest.fixture
11+
def filepath_hdf5(tmp_path):
12+
yield str(tmp_path / "mofa_pytest.hdf5")
1313

1414

1515
@pytest.fixture(scope="module")

0 commit comments

Comments
 (0)