stubtest_third_party: advice for unused allowlist entries (#6208)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2021-10-27 21:55:18 -07:00
committed by GitHub
parent 41591f2fcd
commit 9f691d9c6e

View File

@@ -104,13 +104,20 @@ def run_stubtest(dist: Path) -> None:
except subprocess.CalledProcessError:
print(f"stubtest failed for {dist.name}", file=sys.stderr)
print("\n\n", file=sys.stderr)
if not allowlist_path.exists():
if allowlist_path.exists():
print(
'To fix "unused allowlist" errors, remove the corresponding entries from '
f"{allowlist_path}",
file=sys.stderr,
)
else:
print(
"Re-running stubtest with --generate-allowlist.\n"
f"Add the following to {allowlist_path}:"
f"Add the following to {allowlist_path}:",
file=sys.stderr,
)
subprocess.run(cmd + ["--generate-allowlist"], env={"MYPYPATH": str(dist)})
print("\n\n")
print("\n\n", file=sys.stderr)
raise StubtestFailed from None
else:
print(f"stubtest succeeded for {dist.name}", file=sys.stderr)