Skip to content
Snippets Groups Projects
Commit 997462df authored by ulif's avatar ulif
Browse files

Add fixture for setting $HOME automatically.

With the new config module in place we must make sure, that any user
maintained .diceware.ini files do not interfere with tests.

The fixture sets $HOME for all tests automatically.
parent 279dd6f3
No related branches found
No related tags found
No related merge requests found
......@@ -30,3 +30,17 @@ def home_dir(request, monkeypatch, tmpdir):
tmpdir.mkdir("home")
monkeypatch.setenv("HOME", str(tmpdir / "home"))
return tmpdir / "home"
@pytest.fixture(autouse=True)
def change_home(monkeypatch, tmpdir):
"""Set $HOME to some tempdir.
This is an autouse fixture.
If the user running tests has an own .diceware.ini in his home, then
this will influence tests. Therefore we set the user home to some
empty dir while tests are running.
"""
monkeypatch.setenv("HOME", str(tmpdir))
return tmpdir
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment