@@ -743,10 +743,8 @@ def pytest_internalerror(self, excrepr):
743743 assert not err
744744
745745
746- def test_load_initial_conftest_last_ordering (testdir ):
747- from _pytest .config import get_config
748-
749- pm = get_config ().pluginmanager
746+ def test_load_initial_conftest_last_ordering (testdir , _config_for_test ):
747+ pm = _config_for_test .pluginmanager
750748
751749 class My (object ):
752750 def pytest_load_initial_conftests (self ):
@@ -1018,21 +1016,17 @@ def test_with_existing_file_in_subdir(self, tmpdir):
10181016 assert rootdir == tmpdir
10191017 assert inifile is None
10201018
1021- def test_addopts_before_initini (self , monkeypatch ):
1019+ def test_addopts_before_initini (self , monkeypatch , _config_for_test ):
10221020 cache_dir = ".custom_cache"
10231021 monkeypatch .setenv ("PYTEST_ADDOPTS" , "-o cache_dir=%s" % cache_dir )
1024- from _pytest .config import get_config
1025-
1026- config = get_config ()
1022+ config = _config_for_test
10271023 config ._preparse ([], addopts = True )
10281024 assert config ._override_ini == ["cache_dir=%s" % cache_dir ]
10291025
1030- def test_addopts_from_env_not_concatenated (self , monkeypatch ):
1026+ def test_addopts_from_env_not_concatenated (self , monkeypatch , _config_for_test ):
10311027 """PYTEST_ADDOPTS should not take values from normal args (#4265)."""
1032- from _pytest .config import get_config
1033-
10341028 monkeypatch .setenv ("PYTEST_ADDOPTS" , "-o" )
1035- config = get_config ()
1029+ config = _config_for_test
10361030 with pytest .raises (UsageError ) as excinfo :
10371031 config ._preparse (["cache_dir=ignored" ], addopts = True )
10381032 assert (
@@ -1057,11 +1051,9 @@ def test_addopts_from_ini_not_concatenated(self, testdir):
10571051 )
10581052 assert result .ret == _pytest .main .EXIT_USAGEERROR
10591053
1060- def test_override_ini_does_not_contain_paths (self ):
1054+ def test_override_ini_does_not_contain_paths (self , _config_for_test ):
10611055 """Check that -o no longer swallows all options after it (#3103)"""
1062- from _pytest .config import get_config
1063-
1064- config = get_config ()
1056+ config = _config_for_test
10651057 config ._preparse (["-o" , "cache_dir=/cache" , "/some/test/path" ])
10661058 assert config ._override_ini == ["cache_dir=/cache" ]
10671059
0 commit comments