Skip to content

Commit d998a9a

Browse files
committed
Let pytest run from root dir
1 parent 8293ca7 commit d998a9a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
[build-system]
22
requires = ["setuptools>=38", "wheel", "pybind11>=2.2,<3", 'numpy>=1.17']
3+
4+
[tool.pytest.ini_options]
5+
testpaths = [
6+
"tests",
7+
]

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import pytest
2+
13
def pytest_collectstart(collector):
24
if hasattr(collector, 'skip_compare'):
35
collector.skip_compare += 'stderr',
6+
7+
# cf. https://stackoverflow.com/questions/62044541/change-pytest-working-directory-to-test-case-directory
8+
@pytest.fixture(autouse=True)
9+
def change_test_dir(request, monkeypatch):
10+
monkeypatch.chdir(request.fspath.dirname)

0 commit comments

Comments
 (0)