Skip to content

stubtest: option to not set ignore-missing-stub #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
9 changes: 6 additions & 3 deletions scripts/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ 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])
run_job(_DIST_STEPS[:2] + [stubtest])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stubtest does not need to rename pandas-stubs to _pandas-stubs

5 changes: 3 additions & 2 deletions scripts/test/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down