Skip to content

Commit 776d01d

Browse files
authored
allow the use of --show-traceback and --pdb with stubtest (#18037)
Mypy's error handling suggests using -`-show-traceback` and `--pdb` for more information, and this can occur while running stubtest. This MR adds support for both flags to stubtest so that the suggestions can be followed without needing to figure out the equivalent mypy invocation first.
1 parent 87fb470 commit 776d01d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mypy/stubtest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,8 @@ class _Arguments:
18931893
custom_typeshed_dir: str | None
18941894
check_typeshed: bool
18951895
version: str
1896+
show_traceback: bool
1897+
pdb: bool
18961898

18971899

18981900
# typeshed added a stub for __main__, but that causes stubtest to check itself
@@ -1938,6 +1940,8 @@ def test_stubs(args: _Arguments, use_builtins_fixtures: bool = False) -> int:
19381940
options.abs_custom_typeshed_dir = os.path.abspath(options.custom_typeshed_dir)
19391941
options.config_file = args.mypy_config_file
19401942
options.use_builtins_fixtures = use_builtins_fixtures
1943+
options.show_traceback = args.show_traceback
1944+
options.pdb = args.pdb
19411945

19421946
if options.config_file:
19431947

@@ -2091,6 +2095,10 @@ def parse_options(args: list[str]) -> _Arguments:
20912095
parser.add_argument(
20922096
"--version", action="version", version="%(prog)s " + mypy.version.__version__
20932097
)
2098+
parser.add_argument("--pdb", action="store_true", help="Invoke pdb on fatal error")
2099+
parser.add_argument(
2100+
"--show-traceback", "--tb", action="store_true", help="Show traceback on fatal error"
2101+
)
20942102

20952103
return parser.parse_args(args, namespace=_Arguments())
20962104

0 commit comments

Comments
 (0)