@@ -784,10 +784,8 @@ def pytest_internalerror(self, excrepr):
784784 assert not err
785785
786786
787- def test_load_initial_conftest_last_ordering (testdir ):
788- from _pytest .config import get_config
789-
790- pm = get_config ().pluginmanager
787+ def test_load_initial_conftest_last_ordering (testdir , _config_for_test ):
788+ pm = _config_for_test .pluginmanager
791789
792790 class My (object ):
793791 def pytest_load_initial_conftests (self ):
@@ -1059,21 +1057,17 @@ def test_with_existing_file_in_subdir(self, tmpdir):
10591057 assert rootdir == tmpdir
10601058 assert inifile is None
10611059
1062- def test_addopts_before_initini (self , monkeypatch ):
1060+ def test_addopts_before_initini (self , monkeypatch , _config_for_test ):
10631061 cache_dir = ".custom_cache"
10641062 monkeypatch .setenv ("PYTEST_ADDOPTS" , "-o cache_dir=%s" % cache_dir )
1065- from _pytest .config import get_config
1066-
1067- config = get_config ()
1063+ config = _config_for_test
10681064 config ._preparse ([], addopts = True )
10691065 assert config ._override_ini == ["cache_dir=%s" % cache_dir ]
10701066
1071- def test_addopts_from_env_not_concatenated (self , monkeypatch ):
1067+ def test_addopts_from_env_not_concatenated (self , monkeypatch , _config_for_test ):
10721068 """PYTEST_ADDOPTS should not take values from normal args (#4265)."""
1073- from _pytest .config import get_config
1074-
10751069 monkeypatch .setenv ("PYTEST_ADDOPTS" , "-o" )
1076- config = get_config ()
1070+ config = _config_for_test
10771071 with pytest .raises (UsageError ) as excinfo :
10781072 config ._preparse (["cache_dir=ignored" ], addopts = True )
10791073 assert (
@@ -1098,11 +1092,9 @@ def test_addopts_from_ini_not_concatenated(self, testdir):
10981092 )
10991093 assert result .ret == _pytest .main .EXIT_USAGEERROR
11001094
1101- def test_override_ini_does_not_contain_paths (self ):
1095+ def test_override_ini_does_not_contain_paths (self , _config_for_test ):
11021096 """Check that -o no longer swallows all options after it (#3103)"""
1103- from _pytest .config import get_config
1104-
1105- config = get_config ()
1097+ config = _config_for_test
11061098 config ._preparse (["-o" , "cache_dir=/cache" , "/some/test/path" ])
11071099 assert config ._override_ini == ["cache_dir=/cache" ]
11081100
0 commit comments