diff --git a/testing/test_config.py b/testing/test_config.py index 3cad6d587c4..b10354da282 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -843,3 +843,10 @@ def test_with_existing_file_in_subdir(self, tmpdir): rootdir, inifile, inicfg = determine_setup(None, ['a/exist']) assert rootdir == tmpdir assert inifile is None + + def test_addopts_before_initini(self, testdir, tmpdir, monkeypatch): + monkeypatch.setenv('PYTEST_ADDOPTS', '-o cache_dir=/somewhere') + from _pytest.config import get_config + config = get_config() + config._preparse([], addopts=True) + assert config._override_ini == [['cache_dir=/somewhere']]