Skip to content

Commit 1ec0bb9

Browse files
authored
stubtest: option to not set ignore-missing-stub (#183)
* stubtest: option to not set ignore-missing-stub * remove print
1 parent f031ccf commit 1ec0bb9

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ help = "Run pyright on 'tests' using the installed stubs"
8989
script = "scripts.test:test(dist=True, type_checker='pyright')"
9090

9191
[tool.poe.tasks.stubtest]
92-
script = "scripts.test:stubtest(allowlist)"
92+
script = "scripts.test:stubtest(allowlist, check_missing)"
9393
help = "Run stubtest to compare the installed stubs against pandas"
94-
args = [{ name = "allowlist", positional = true, default = "", required = false, help= "Path to an allowlist (optional)" }]
94+
args = [{ name = "allowlist", positional = true, default = "", required = false, help= "Path to an allowlist (optional)" }, {name = "check_missing", positional = false, default = false, type = "boolean", required = false, help= "Report errors when the stubs are incomplete (off by default)"}]
9595

9696

9797
[tool.black]

scripts/test/__init__.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ def test(
3535
run_job(steps)
3636

3737

38-
def stubtest(allowlist: str):
38+
def stubtest(allowlist: str, check_missing: bool):
3939
stubtest = dataclasses.replace(
40-
_step.stubtest, run=partial(_step.stubtest.run, allowlist=allowlist)
40+
_step.stubtest,
41+
run=partial(
42+
_step.stubtest.run, allowlist=allowlist, check_missing=check_missing
43+
),
4144
)
42-
run_job(_DIST_STEPS[:-2] + [stubtest])
45+
run_job(_DIST_STEPS[:2] + [stubtest])

scripts/test/run.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ def style():
2323
subprocess.run(cmd, check=True)
2424

2525

26-
def stubtest(allowlist: str = ""):
26+
def stubtest(allowlist: str = "", check_missing: bool = False):
2727
cmd = [
2828
sys.executable,
2929
"-m",
3030
"mypy.stubtest",
3131
"pandas",
3232
"--concise",
33-
"--ignore-missing-stub",
3433
"--mypy-config-file",
3534
"pyproject.toml",
3635
]
36+
if not check_missing:
37+
cmd += ["--ignore-missing-stub"]
3738
if allowlist:
3839
cmd += ["--allowlist", allowlist]
3940
subprocess.run(cmd, check=True)

0 commit comments

Comments
 (0)