mirror of
https://github.com/chatmail/relay.git
synced 2026-05-18 20:08:21 +00:00
discover chatmail.ini in tests from CWD and all parent dirs (tox runs change dirs)
This commit is contained in:
@@ -40,10 +40,16 @@ def pytest_runtest_setup(item):
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def chatmail_config(pytestconfig):
|
def chatmail_config(pytestconfig):
|
||||||
path = Path("chatmail.ini").resolve()
|
current = basedir = Path()
|
||||||
if path.exists():
|
while 1:
|
||||||
return read_config(path)
|
path = current.joinpath("chatmail.ini").resolve()
|
||||||
pytest.skip(f"no chatmail.ini file found in {path}")
|
if path.exists():
|
||||||
|
return read_config(path)
|
||||||
|
if current == current.parent:
|
||||||
|
break
|
||||||
|
current = current.parent
|
||||||
|
|
||||||
|
pytest.skip(f"no chatmail.ini file found in {basedir} or parent dirs")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
Reference in New Issue
Block a user