@@ -743,10 +743,8 @@ def pytest_internalerror(self, excrepr):
743
743
assert not err
744
744
745
745
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
750
748
751
749
class My (object ):
752
750
def pytest_load_initial_conftests (self ):
@@ -1018,21 +1016,17 @@ def test_with_existing_file_in_subdir(self, tmpdir):
1018
1016
assert rootdir == tmpdir
1019
1017
assert inifile is None
1020
1018
1021
- def test_addopts_before_initini (self , monkeypatch ):
1019
+ def test_addopts_before_initini (self , monkeypatch , _config_for_test ):
1022
1020
cache_dir = ".custom_cache"
1023
1021
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
1027
1023
config ._preparse ([], addopts = True )
1028
1024
assert config ._override_ini == ["cache_dir=%s" % cache_dir ]
1029
1025
1030
- def test_addopts_from_env_not_concatenated (self , monkeypatch ):
1026
+ def test_addopts_from_env_not_concatenated (self , monkeypatch , _config_for_test ):
1031
1027
"""PYTEST_ADDOPTS should not take values from normal args (#4265)."""
1032
- from _pytest .config import get_config
1033
-
1034
1028
monkeypatch .setenv ("PYTEST_ADDOPTS" , "-o" )
1035
- config = get_config ()
1029
+ config = _config_for_test
1036
1030
with pytest .raises (UsageError ) as excinfo :
1037
1031
config ._preparse (["cache_dir=ignored" ], addopts = True )
1038
1032
assert (
@@ -1057,11 +1051,9 @@ def test_addopts_from_ini_not_concatenated(self, testdir):
1057
1051
)
1058
1052
assert result .ret == _pytest .main .EXIT_USAGEERROR
1059
1053
1060
- def test_override_ini_does_not_contain_paths (self ):
1054
+ def test_override_ini_does_not_contain_paths (self , _config_for_test ):
1061
1055
"""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
1065
1057
config ._preparse (["-o" , "cache_dir=/cache" , "/some/test/path" ])
1066
1058
assert config ._override_ini == ["cache_dir=/cache" ]
1067
1059
0 commit comments