@@ -768,10 +768,8 @@ def pytest_internalerror(self, excrepr):
768768 assert not err
769769
770770
771- def test_load_initial_conftest_last_ordering (testdir ):
772- from _pytest .config import get_config
773-
774- pm = get_config ().pluginmanager
771+ def test_load_initial_conftest_last_ordering (testdir , _config_for_test ):
772+ pm = _config_for_test .pluginmanager
775773
776774 class My (object ):
777775 def pytest_load_initial_conftests (self ):
@@ -1043,21 +1041,17 @@ def test_with_existing_file_in_subdir(self, tmpdir):
10431041 assert rootdir == tmpdir
10441042 assert inifile is None
10451043
1046- def test_addopts_before_initini (self , monkeypatch ):
1044+ def test_addopts_before_initini (self , monkeypatch , _config_for_test ):
10471045 cache_dir = ".custom_cache"
10481046 monkeypatch .setenv ("PYTEST_ADDOPTS" , "-o cache_dir=%s" % cache_dir )
1049- from _pytest .config import get_config
1050-
1051- config = get_config ()
1047+ config = _config_for_test
10521048 config ._preparse ([], addopts = True )
10531049 assert config ._override_ini == ["cache_dir=%s" % cache_dir ]
10541050
1055- def test_addopts_from_env_not_concatenated (self , monkeypatch ):
1051+ def test_addopts_from_env_not_concatenated (self , monkeypatch , _config_for_test ):
10561052 """PYTEST_ADDOPTS should not take values from normal args (#4265)."""
1057- from _pytest .config import get_config
1058-
10591053 monkeypatch .setenv ("PYTEST_ADDOPTS" , "-o" )
1060- config = get_config ()
1054+ config = _config_for_test
10611055 with pytest .raises (UsageError ) as excinfo :
10621056 config ._preparse (["cache_dir=ignored" ], addopts = True )
10631057 assert (
@@ -1082,11 +1076,9 @@ def test_addopts_from_ini_not_concatenated(self, testdir):
10821076 )
10831077 assert result .ret == _pytest .main .EXIT_USAGEERROR
10841078
1085- def test_override_ini_does_not_contain_paths (self ):
1079+ def test_override_ini_does_not_contain_paths (self , _config_for_test ):
10861080 """Check that -o no longer swallows all options after it (#3103)"""
1087- from _pytest .config import get_config
1088-
1089- config = get_config ()
1081+ config = _config_for_test
10901082 config ._preparse (["-o" , "cache_dir=/cache" , "/some/test/path" ])
10911083 assert config ._override_ini == ["cache_dir=/cache" ]
10921084
0 commit comments