From 9a1dc6842620d65f3b399cf54f25c22c9f975e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20W=C3=B6rtwein?= Date: Fri, 5 Aug 2022 12:33:55 -0400 Subject: [PATCH 1/2] stubtest: option to not set ignore-missing-stub --- pyproject.toml | 4 ++-- scripts/test/__init__.py | 10 +++++++--- scripts/test/run.py | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1cc152c78..e6b72bfcb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,9 +89,9 @@ help = "Run pyright on 'tests' using the installed stubs" script = "scripts.test:test(dist=True, type_checker='pyright')" [tool.poe.tasks.stubtest] -script = "scripts.test:stubtest(allowlist)" +script = "scripts.test:stubtest(allowlist, check_missing)" help = "Run stubtest to compare the installed stubs against pandas" -args = [{ name = "allowlist", positional = true, default = "", required = false, help= "Path to an allowlist (optional)" }] +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)"}] [tool.black] diff --git a/scripts/test/__init__.py b/scripts/test/__init__.py index b5422a2fe..13cd26111 100644 --- a/scripts/test/__init__.py +++ b/scripts/test/__init__.py @@ -35,8 +35,12 @@ def test( run_job(steps) -def stubtest(allowlist: str): +def stubtest(allowlist: str, check_missing: bool): stubtest = dataclasses.replace( - _step.stubtest, run=partial(_step.stubtest.run, allowlist=allowlist) + _step.stubtest, + run=partial( + _step.stubtest.run, allowlist=allowlist, check_missing=check_missing + ), ) - run_job(_DIST_STEPS[:-2] + [stubtest]) + print(_DIST_STEPS[:2]) + run_job(_DIST_STEPS[:2] + [stubtest]) diff --git a/scripts/test/run.py b/scripts/test/run.py index 4cd9e2dd1..49ec28662 100644 --- a/scripts/test/run.py +++ b/scripts/test/run.py @@ -23,17 +23,18 @@ def style(): subprocess.run(cmd, check=True) -def stubtest(allowlist: str = ""): +def stubtest(allowlist: str = "", check_missing: bool = False): cmd = [ sys.executable, "-m", "mypy.stubtest", "pandas", "--concise", - "--ignore-missing-stub", "--mypy-config-file", "pyproject.toml", ] + if not check_missing: + cmd += ["--ignore-missing-stub"] if allowlist: cmd += ["--allowlist", allowlist] subprocess.run(cmd, check=True) From b91cbe6e5de9810e19ace9f46c2e1a2765bc58b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20W=C3=B6rtwein?= Date: Fri, 5 Aug 2022 12:36:45 -0400 Subject: [PATCH 2/2] remove print --- scripts/test/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/test/__init__.py b/scripts/test/__init__.py index 13cd26111..6ba7b65e5 100644 --- a/scripts/test/__init__.py +++ b/scripts/test/__init__.py @@ -42,5 +42,4 @@ def stubtest(allowlist: str, check_missing: bool): _step.stubtest.run, allowlist=allowlist, check_missing=check_missing ), ) - print(_DIST_STEPS[:2]) run_job(_DIST_STEPS[:2] + [stubtest])