Skip to content

Commit 3d79d84

Browse files
Remove mypy overrides for tests.test_quickstart (#13749)
1 parent a7bab7e commit 3d79d84

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ disallow_untyped_defs = false
294294
[[tool.mypy.overrides]]
295295
module = [
296296
# tests/
297-
"tests.test_quickstart",
298297
"tests.test_search",
299298
# tests/test_builders
300299
"tests.test_builders.test_build_latex",

sphinx/cmd/quickstart.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989

9090

9191
# function to get input from terminal -- overridden by the test suite
92-
def term_input(prompt: str) -> str:
92+
# Arguments are positional-only to match ``input``.
93+
def term_input(prompt: str, /) -> str:
9394
if sys.platform == 'win32':
9495
# Important: On windows, readline is not enabled by default. In these
9596
# environment, escape sequences have been broken. To avoid the

tests/test_quickstart.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
warnfile = StringIO()
2121

2222

23-
def setup_module():
23+
def setup_module() -> None:
2424
disable_colour()
2525

2626

@@ -48,7 +48,7 @@ def input_(prompt: str) -> str:
4848
real_input: Callable[[str], str] = input
4949

5050

51-
def teardown_module():
51+
def teardown_module() -> None:
5252
qs.term_input = real_input
5353
enable_colour()
5454

@@ -61,7 +61,7 @@ def test_do_prompt() -> None:
6161
'Q5': 'no',
6262
'Q6': 'foo',
6363
}
64-
qs.term_input = mock_input(answers) # type: ignore[assignment]
64+
qs.term_input = mock_input(answers)
6565

6666
assert qs.do_prompt('Q1', default='v1') == 'v1'
6767
assert qs.do_prompt('Q3', default='v3_default') == 'v3'
@@ -79,7 +79,7 @@ def test_do_prompt_inputstrip() -> None:
7979
'Q3': 'N',
8080
'Q4': 'N ',
8181
}
82-
qs.term_input = mock_input(answers) # type: ignore[assignment]
82+
qs.term_input = mock_input(answers)
8383

8484
assert qs.do_prompt('Q1') == 'Y'
8585
assert qs.do_prompt('Q2') == 'Yes'
@@ -91,12 +91,12 @@ def test_do_prompt_with_nonascii() -> None:
9191
answers = {
9292
'Q1': '\u30c9\u30a4\u30c4',
9393
}
94-
qs.term_input = mock_input(answers) # type: ignore[assignment]
94+
qs.term_input = mock_input(answers)
9595
result = qs.do_prompt('Q1', default='\u65e5\u672c')
9696
assert result == '\u30c9\u30a4\u30c4'
9797

9898

99-
def test_quickstart_defaults(tmp_path):
99+
def test_quickstart_defaults(tmp_path: Path) -> None:
100100
answers = {
101101
'Root path': str(tmp_path),
102102
'Project name': 'Sphinx Test',
@@ -127,7 +127,7 @@ def test_quickstart_defaults(tmp_path):
127127
assert (tmp_path / 'make.bat').is_file()
128128

129129

130-
def test_quickstart_all_answers(tmp_path):
130+
def test_quickstart_all_answers(tmp_path: Path) -> None:
131131
answers = {
132132
'Root path': str(tmp_path),
133133
'Separate source and build': 'y',
@@ -185,7 +185,7 @@ def test_quickstart_all_answers(tmp_path):
185185
assert (tmp_path / 'source' / 'contents.txt').is_file()
186186

187187

188-
def test_generated_files_eol(tmp_path):
188+
def test_generated_files_eol(tmp_path: Path) -> None:
189189
answers = {
190190
'Root path': str(tmp_path),
191191
'Project name': 'Sphinx Test',
@@ -205,7 +205,7 @@ def assert_eol(filename: Path, eol: str) -> None:
205205
assert_eol(tmp_path / 'Makefile', '\n')
206206

207207

208-
def test_quickstart_and_build(tmp_path):
208+
def test_quickstart_and_build(tmp_path: Path) -> None:
209209
answers = {
210210
'Root path': str(tmp_path),
211211
'Project name': 'Fullwidth characters: \u30c9\u30a4\u30c4',
@@ -224,7 +224,7 @@ def test_quickstart_and_build(tmp_path):
224224
assert not warnings
225225

226226

227-
def test_default_filename(tmp_path):
227+
def test_default_filename(tmp_path: Path) -> None:
228228
answers = {
229229
'Root path': str(tmp_path),
230230
'Project name': '\u30c9\u30a4\u30c4', # Fullwidth characters only
@@ -242,7 +242,7 @@ def test_default_filename(tmp_path):
242242
exec(conffile.read_text(encoding='utf8'), ns) # NoQA: S102
243243

244244

245-
def test_extensions(tmp_path):
245+
def test_extensions(tmp_path: Path) -> None:
246246
qs.main([
247247
'-q',
248248
'-p',
@@ -261,7 +261,7 @@ def test_extensions(tmp_path):
261261
assert ns['extensions'] == ['foo', 'bar', 'baz']
262262

263263

264-
def test_exits_when_existing_confpy(monkeypatch):
264+
def test_exits_when_existing_confpy(monkeypatch: pytest.MonkeyPatch) -> None:
265265
# The code detects existing conf.py with path.is_file()
266266
# so we mock it as True with pytest's monkeypatch
267267
monkeypatch.setattr('os.path.isfile', lambda path: True)

0 commit comments

Comments
 (0)