@@ -32,7 +32,7 @@ def test_getcfg_and_config(self, testdir, tmpdir, section, filename):
32
32
)
33
33
)
34
34
)
35
- rootdir , inifile , cfg = getcfg ([sub ])
35
+ _ , _ , cfg = getcfg ([sub ])
36
36
assert cfg ["name" ] == "value"
37
37
config = testdir .parseconfigure (sub )
38
38
assert config .inicfg ["name" ] == "value"
@@ -441,8 +441,6 @@ def test_iter_rewritable_modules(self, names, expected):
441
441
442
442
class TestConfigFromdictargs :
443
443
def test_basic_behavior (self , _sys_snapshot ):
444
- from _pytest .config import Config
445
-
446
444
option_dict = {"verbose" : 444 , "foo" : "bar" , "capture" : "no" }
447
445
args = ["a" , "b" ]
448
446
@@ -456,8 +454,6 @@ def test_basic_behavior(self, _sys_snapshot):
456
454
457
455
def test_invocation_params_args (self , _sys_snapshot ):
458
456
"""Show that fromdictargs can handle args in their "orig" format"""
459
- from _pytest .config import Config
460
-
461
457
option_dict = {}
462
458
args = ["-vvvv" , "-s" , "a" , "b" ]
463
459
@@ -477,8 +473,6 @@ def test_inifilename(self, tmpdir):
477
473
)
478
474
)
479
475
480
- from _pytest .config import Config
481
-
482
476
inifile = "../../foo/bar.ini"
483
477
option_dict = {"inifilename" : inifile , "capture" : "no" }
484
478
@@ -771,23 +765,23 @@ def test_notify_exception(testdir, capfd):
771
765
with pytest .raises (ValueError ) as excinfo :
772
766
raise ValueError (1 )
773
767
config .notify_exception (excinfo , config .option )
774
- out , err = capfd .readouterr ()
768
+ _ , err = capfd .readouterr ()
775
769
assert "ValueError" in err
776
770
777
771
class A :
778
- def pytest_internalerror (self , excrepr ):
772
+ def pytest_internalerror (self ):
779
773
return True
780
774
781
775
config .pluginmanager .register (A ())
782
776
config .notify_exception (excinfo , config .option )
783
- out , err = capfd .readouterr ()
777
+ _ , err = capfd .readouterr ()
784
778
assert not err
785
779
786
780
config = testdir .parseconfig ("-p" , "no:terminal" )
787
781
with pytest .raises (ValueError ) as excinfo :
788
782
raise ValueError (1 )
789
783
config .notify_exception (excinfo , config .option )
790
- out , err = capfd .readouterr ()
784
+ _ , err = capfd .readouterr ()
791
785
assert "ValueError" in err
792
786
793
787
@@ -797,7 +791,7 @@ def test_no_terminal_discovery_error(testdir):
797
791
assert result .ret == ExitCode .INTERRUPTED
798
792
799
793
800
- def test_load_initial_conftest_last_ordering (testdir , _config_for_test ):
794
+ def test_load_initial_conftest_last_ordering (_config_for_test ):
801
795
pm = _config_for_test .pluginmanager
802
796
803
797
class My :
@@ -866,21 +860,21 @@ def test_with_ini(self, tmpdir, name) -> None:
866
860
a = tmpdir .mkdir ("a" )
867
861
b = a .mkdir ("b" )
868
862
for args in ([tmpdir ], [a ], [b ]):
869
- rootdir , inifile , inicfg = determine_setup (None , args )
863
+ rootdir , parsed_inifile , _ = determine_setup (None , args )
870
864
assert rootdir == tmpdir
871
- assert inifile == inifile
872
- rootdir , inifile , inicfg = determine_setup (None , [b , a ])
865
+ assert parsed_inifile == inifile
866
+ rootdir , parsed_inifile , _ = determine_setup (None , [b , a ])
873
867
assert rootdir == tmpdir
874
- assert inifile == inifile
868
+ assert parsed_inifile == inifile
875
869
876
870
@pytest .mark .parametrize ("name" , "setup.cfg tox.ini" .split ())
877
871
def test_pytestini_overrides_empty_other (self , tmpdir , name ) -> None :
878
872
inifile = tmpdir .ensure ("pytest.ini" )
879
873
a = tmpdir .mkdir ("a" )
880
874
a .ensure (name )
881
- rootdir , inifile , inicfg = determine_setup (None , [a ])
875
+ rootdir , parsed_inifile , _ = determine_setup (None , [a ])
882
876
assert rootdir == tmpdir
883
- assert inifile == inifile
877
+ assert parsed_inifile == inifile
884
878
885
879
def test_setuppy_fallback (self , tmpdir ) -> None :
886
880
a = tmpdir .mkdir ("a" )
@@ -900,7 +894,7 @@ def test_nothing(self, tmpdir, monkeypatch) -> None:
900
894
901
895
def test_with_specific_inifile (self , tmpdir ) -> None :
902
896
inifile = tmpdir .ensure ("pytest.ini" )
903
- rootdir , inifile , inicfg = determine_setup (inifile , [tmpdir ])
897
+ rootdir , _ , _ = determine_setup (inifile , [tmpdir ])
904
898
assert rootdir == tmpdir
905
899
906
900
@@ -1043,30 +1037,30 @@ def test_with_arg_outside_cwd_without_inifile(self, tmpdir, monkeypatch) -> None
1043
1037
monkeypatch .chdir (str (tmpdir ))
1044
1038
a = tmpdir .mkdir ("a" )
1045
1039
b = tmpdir .mkdir ("b" )
1046
- rootdir , inifile , inicfg = determine_setup (None , [a , b ])
1040
+ rootdir , inifile , _ = determine_setup (None , [a , b ])
1047
1041
assert rootdir == tmpdir
1048
1042
assert inifile is None
1049
1043
1050
1044
def test_with_arg_outside_cwd_with_inifile (self , tmpdir ) -> None :
1051
1045
a = tmpdir .mkdir ("a" )
1052
1046
b = tmpdir .mkdir ("b" )
1053
1047
inifile = a .ensure ("pytest.ini" )
1054
- rootdir , parsed_inifile , inicfg = determine_setup (None , [a , b ])
1048
+ rootdir , parsed_inifile , _ = determine_setup (None , [a , b ])
1055
1049
assert rootdir == a
1056
1050
assert inifile == parsed_inifile
1057
1051
1058
1052
@pytest .mark .parametrize ("dirs" , ([], ["does-not-exist" ], ["a/does-not-exist" ]))
1059
1053
def test_with_non_dir_arg (self , dirs , tmpdir ) -> None :
1060
1054
with tmpdir .ensure (dir = True ).as_cwd ():
1061
- rootdir , inifile , inicfg = determine_setup (None , dirs )
1055
+ rootdir , inifile , _ = determine_setup (None , dirs )
1062
1056
assert rootdir == tmpdir
1063
1057
assert inifile is None
1064
1058
1065
1059
def test_with_existing_file_in_subdir (self , tmpdir ) -> None :
1066
1060
a = tmpdir .mkdir ("a" )
1067
1061
a .ensure ("exist" )
1068
1062
with tmpdir .as_cwd ():
1069
- rootdir , inifile , inicfg = determine_setup (None , ["a/exist" ])
1063
+ rootdir , inifile , _ = determine_setup (None , ["a/exist" ])
1070
1064
assert rootdir == tmpdir
1071
1065
assert inifile is None
1072
1066
@@ -1111,7 +1105,7 @@ def test_override_ini_does_not_contain_paths(self, _config_for_test, _sys_snapsh
1111
1105
config ._preparse (["-o" , "cache_dir=/cache" , "/some/test/path" ])
1112
1106
assert config ._override_ini == ["cache_dir=/cache" ]
1113
1107
1114
- def test_multiple_override_ini_options (self , testdir , request ):
1108
+ def test_multiple_override_ini_options (self , testdir ):
1115
1109
"""Ensure a file path following a '-o' option does not generate an error (#3103)"""
1116
1110
testdir .makepyfile (
1117
1111
** {
@@ -1201,7 +1195,7 @@ def pytest_addoption(parser):
1201
1195
assert result .ret == ExitCode .USAGE_ERROR
1202
1196
1203
1197
1204
- def test_help_formatter_uses_py_get_terminal_width (testdir , monkeypatch ):
1198
+ def test_help_formatter_uses_py_get_terminal_width (monkeypatch ):
1205
1199
from _pytest .config .argparsing import DropShorterLongHelpFormatter
1206
1200
1207
1201
monkeypatch .setenv ("COLUMNS" , "90" )
0 commit comments