Use monkeypatch.setenv instead of os.putenv.
This ensures the environment is modified only for the test using the fixture rather than for the whole test run.
This commit is contained in:
parent
7d36847f77
commit
7b3406a3e4
@ -435,11 +435,11 @@ def data_tmpdir(monkeypatch, tmpdir):
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def redirect_xdg_data(data_tmpdir):
|
||||
def redirect_xdg_data(data_tmpdir, monkeypatch):
|
||||
"""Set XDG_DATA_HOME to a temp location.
|
||||
|
||||
While data_tmpdir covers most cases by redirecting standarddir.data(), this
|
||||
is not enough for places Qt references the data dir internally. For these,
|
||||
we need to set the environment variable to redirect data access.
|
||||
"""
|
||||
os.putenv('XDG_DATA_HOME', str(data_tmpdir))
|
||||
monkeypatch.setenv('XDG_DATA_HOME', str(data_tmpdir))
|
||||
|
Loading…
Reference in New Issue
Block a user