Use a relative cache_dir in test because of how arguments are parsed on Windows

We use shlex to parse command-line arguments and PYTEST_ADDOPTS, so passing
a full path with '\' arguments produces incorrect results on Windows

Anyway users are advised to use relative paths for portability
This commit is contained in:
Bruno Oliveira 2017-10-11 19:37:17 -03:00
parent ce8c829945
commit 10a3b9118b
1 changed files with 1 additions and 1 deletions

View File

@ -845,7 +845,7 @@ class TestOverrideIniArgs(object):
assert inifile is None assert inifile is None
def test_addopts_before_initini(self, testdir, tmpdir, monkeypatch): def test_addopts_before_initini(self, testdir, tmpdir, monkeypatch):
cache_dir = testdir.tmpdir.join('.custom_cache') cache_dir = '.custom_cache'
monkeypatch.setenv('PYTEST_ADDOPTS', '-o cache_dir=%s' % cache_dir) monkeypatch.setenv('PYTEST_ADDOPTS', '-o cache_dir=%s' % cache_dir)
from _pytest.config import get_config from _pytest.config import get_config
config = get_config() config = get_config()