mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-05 09:27:38 +08:00
Find unused stubtest whitelist entries (#4157)
* Find unused stubtest whitelist entries This is currently a GitHub workflow that runs daily and lists all unused whitelist entries found by running stubtest against current Python versions on Linux and Windows. The workflow run will succeed if there are no such entries, and fail otherwise. In a second step, this should collate the output of the various runs and create a PR to remove the entries. In that case, the workflow should probably only run weekly or even monthly to keep the noise down. Cf. #3728
This commit is contained in:
@@ -21,6 +21,8 @@ def run_stubtest(typeshed_dir: Path) -> int:
|
||||
platform_whitelist = "{}.txt".format(sys.platform)
|
||||
combined_whitelist = "{}-py{}{}.txt".format(sys.platform, sys.version_info.major, sys.version_info.minor)
|
||||
|
||||
ignore_unused_whitelist = "--ignore-unused-whitelist" in sys.argv[1:]
|
||||
|
||||
cmd = [
|
||||
sys.executable,
|
||||
"-m",
|
||||
@@ -37,6 +39,8 @@ def run_stubtest(typeshed_dir: Path) -> int:
|
||||
"--whitelist",
|
||||
str(whitelist_dir / version_whitelist),
|
||||
]
|
||||
if ignore_unused_whitelist:
|
||||
cmd += ["--ignore-unused-whitelist"]
|
||||
if (whitelist_dir / platform_whitelist).exists():
|
||||
cmd += [
|
||||
"--whitelist",
|
||||
@@ -59,9 +63,6 @@ def run_stubtest(typeshed_dir: Path) -> int:
|
||||
"\nNB: stubtest output depends on the Python version (and system) it is run with. "
|
||||
"See README.md for more details.\n"
|
||||
"NB: We only check positional-only arg accuracy for Python 3.9.\n"
|
||||
"If stubtest is complaining about 'unused whitelist entry' after your fix, please "
|
||||
"remove the entry from the whitelist file. Note you may have to do this for other "
|
||||
"version-specific whitelists as well. Thanks for helping burn the backlog of errors!\n"
|
||||
"\nCommand run was: {}\n".format(" ".join(cmd)),
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user