Skip to content

Commit 117072d

Browse files
committed
typing: fix _pytest.config.findpaths.determine_setup
1 parent 9074000 commit 117072d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/_pytest/config/findpaths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def get_dir_from_path(path):
108108

109109

110110
def determine_setup(
111-
inifile: str,
111+
inifile: Optional[str],
112112
args: List[str],
113113
rootdir_cmd_arg: Optional[str] = None,
114114
config: Optional["Config"] = None,

testing/test_config.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ def test_simple_noini(self, tmpdir):
859859
assert get_common_ancestor([no_path.join("a")]) == tmpdir
860860

861861
@pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split())
862-
def test_with_ini(self, tmpdir, name):
862+
def test_with_ini(self, tmpdir, name) -> None:
863863
inifile = tmpdir.join(name)
864864
inifile.write("[pytest]\n" if name != "setup.cfg" else "[tool:pytest]\n")
865865

@@ -874,15 +874,15 @@ def test_with_ini(self, tmpdir, name):
874874
assert inifile == inifile
875875

876876
@pytest.mark.parametrize("name", "setup.cfg tox.ini".split())
877-
def test_pytestini_overrides_empty_other(self, tmpdir, name):
877+
def test_pytestini_overrides_empty_other(self, tmpdir, name) -> None:
878878
inifile = tmpdir.ensure("pytest.ini")
879879
a = tmpdir.mkdir("a")
880880
a.ensure(name)
881881
rootdir, inifile, inicfg = determine_setup(None, [a])
882882
assert rootdir == tmpdir
883883
assert inifile == inifile
884884

885-
def test_setuppy_fallback(self, tmpdir):
885+
def test_setuppy_fallback(self, tmpdir) -> None:
886886
a = tmpdir.mkdir("a")
887887
a.ensure("setup.cfg")
888888
tmpdir.ensure("setup.py")
@@ -891,14 +891,14 @@ def test_setuppy_fallback(self, tmpdir):
891891
assert inifile is None
892892
assert inicfg == {}
893893

894-
def test_nothing(self, tmpdir, monkeypatch):
894+
def test_nothing(self, tmpdir, monkeypatch) -> None:
895895
monkeypatch.chdir(str(tmpdir))
896896
rootdir, inifile, inicfg = determine_setup(None, [tmpdir])
897897
assert rootdir == tmpdir
898898
assert inifile is None
899899
assert inicfg == {}
900900

901-
def test_with_specific_inifile(self, tmpdir):
901+
def test_with_specific_inifile(self, tmpdir) -> None:
902902
inifile = tmpdir.ensure("pytest.ini")
903903
rootdir, inifile, inicfg = determine_setup(inifile, [tmpdir])
904904
assert rootdir == tmpdir
@@ -1039,15 +1039,15 @@ def test():
10391039
result = testdir.runpytest("--override-ini", "python_files=unittest_*.py")
10401040
result.stdout.fnmatch_lines(["*1 passed in*"])
10411041

1042-
def test_with_arg_outside_cwd_without_inifile(self, tmpdir, monkeypatch):
1042+
def test_with_arg_outside_cwd_without_inifile(self, tmpdir, monkeypatch) -> None:
10431043
monkeypatch.chdir(str(tmpdir))
10441044
a = tmpdir.mkdir("a")
10451045
b = tmpdir.mkdir("b")
10461046
rootdir, inifile, inicfg = determine_setup(None, [a, b])
10471047
assert rootdir == tmpdir
10481048
assert inifile is None
10491049

1050-
def test_with_arg_outside_cwd_with_inifile(self, tmpdir):
1050+
def test_with_arg_outside_cwd_with_inifile(self, tmpdir) -> None:
10511051
a = tmpdir.mkdir("a")
10521052
b = tmpdir.mkdir("b")
10531053
inifile = a.ensure("pytest.ini")
@@ -1056,13 +1056,13 @@ def test_with_arg_outside_cwd_with_inifile(self, tmpdir):
10561056
assert inifile == parsed_inifile
10571057

10581058
@pytest.mark.parametrize("dirs", ([], ["does-not-exist"], ["a/does-not-exist"]))
1059-
def test_with_non_dir_arg(self, dirs, tmpdir):
1059+
def test_with_non_dir_arg(self, dirs, tmpdir) -> None:
10601060
with tmpdir.ensure(dir=True).as_cwd():
10611061
rootdir, inifile, inicfg = determine_setup(None, dirs)
10621062
assert rootdir == tmpdir
10631063
assert inifile is None
10641064

1065-
def test_with_existing_file_in_subdir(self, tmpdir):
1065+
def test_with_existing_file_in_subdir(self, tmpdir) -> None:
10661066
a = tmpdir.mkdir("a")
10671067
a.ensure("exist")
10681068
with tmpdir.as_cwd():

0 commit comments

Comments
 (0)