From cfd928c7e375eea87bddabfb7572284e7156dcb0 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Tue, 10 Oct 2017 12:52:37 -0700 Subject: [PATCH] make custom cache dir a subfolder of testdir --- testing/test_config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/test_config.py b/testing/test_config.py index 80b90efa175..93b288215dc 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -845,8 +845,9 @@ def test_with_existing_file_in_subdir(self, tmpdir): assert inifile is None def test_addopts_before_initini(self, testdir, tmpdir, monkeypatch): - monkeypatch.setenv('PYTEST_ADDOPTS', '-o cache_dir=/somewhere') + cache_dir = testdir.tmpdir.join('.custom_cache') + monkeypatch.setenv('PYTEST_ADDOPTS', '-o cache_dir=%s' % cache_dir) from _pytest.config import get_config config = get_config() config._preparse([], addopts=True) - assert config._override_ini == [['cache_dir=/somewhere']] + assert config._override_ini == [['cache_dir=%s' % cache_dir]]