diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9b57320..f2c8974 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,7 +47,7 @@ jobs: run: pip install "numpy${{ matrix.numpy-version }}" - name: Run Tests - run: pytest -n auto + run: pytest - name: Coveralls Parallel uses: coverallsapp/github-action@v2.3.0 diff --git a/tests/fixtures/paths.py b/tests/fixtures/paths.py index 2a6b133..cda4623 100644 --- a/tests/fixtures/paths.py +++ b/tests/fixtures/paths.py @@ -10,7 +10,7 @@ def tmp_output_dir(request: pytest.FixtureRequest) -> Path: path = Path(__file__).parents[1].resolve() / "__tmp__" if path.exists(): shutil.rmtree(str(path)) - path.mkdir() + path.mkdir(parents=True, exist_ok=True) yield path @@ -26,15 +26,19 @@ def tmp_output_dir(request: pytest.FixtureRequest) -> Path: @pytest.fixture(scope="function") -def tmp_output_dir_func(tmp_output_dir, request: pytest.FixtureRequest) -> Path: +def tmp_output_dir_func( + tmp_output_dir, testrun_uid, request: pytest.FixtureRequest +) -> Path: """ tmp output dir that gets cleared between every function cleans at the start rather than at cleanup in case the output is to be inspected """ subpath = tmp_output_dir / f"__tmpfunc_{request.node.name}__" + if testrun_uid: + subpath = subpath / testrun_uid if subpath.exists(): shutil.rmtree(str(subpath)) - subpath.mkdir() + subpath.mkdir(parents=True) return subpath @@ -47,5 +51,5 @@ def tmp_output_dir_mod(tmp_output_dir, request: pytest.FixtureRequest) -> Path: subpath = tmp_output_dir / f"__tmpmod_{request.module}__" if subpath.exists(): shutil.rmtree(str(subpath)) - subpath.mkdir() + subpath.mkdir(parents=True) return subpath diff --git a/tests/test_ndarray.py b/tests/test_ndarray.py index 18d035b..0f4e7ee 100644 --- a/tests/test_ndarray.py +++ b/tests/test_ndarray.py @@ -389,7 +389,7 @@ def test_callable(): annotation = NDArray[Shape["3"], int] array = np.array([1, 2, 3], dtype=int) validated = annotation(array) - assert validated is array + assert np.array_equal(validated, array) with pytest.raises(DtypeError): _ = annotation(np.zeros((1, 2, 3))) diff --git a/tests/test_testing_helpers.py b/tests/test_testing_helpers.py index 3f93a41..bfb4d51 100644 --- a/tests/test_testing_helpers.py +++ b/tests/test_testing_helpers.py @@ -39,7 +39,7 @@ def test_validation_case_merge(): "interface", [ pytest.param( - i.interface, marks=getattr(pytest.mark, i.interface.interface.name) + i.interface, id=i.id, marks=getattr(pytest.mark, i.interface.interface.name) ) for i in INTERFACE_CASES if i.id not in ("hdf5_compound")