Skip to content

Internal error when running check-classes.test with pytest #18994

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

Closed
lesliehuh opened this issue Apr 28, 2025 · 2 comments
Closed

Internal error when running check-classes.test with pytest #18994

lesliehuh opened this issue Apr 28, 2025 · 2 comments
Labels
bug mypy got something wrong pending Issues that may be closed topic-developer Issues relevant to mypy developers topic-tests

Comments

@lesliehuh
Copy link

Crash Report

FAILURES ===============================================================================
___________________________________________________________________ testInitSubclassUnannotatedMulti ___________________________________________________________________
[gw5] linux -- Python 3.12.9 /workspaces/mypy/venv/bin/python
data: /workspaces/mypy/test-data/unit/check-classes.test:7426:
SystemExit: 2
------------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 8, in <module>
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 1806, in serve
    WorkerGateway(io=io, id=id, _startcount=2).serve()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 1273, in serve
    self._execpool.integrate_as_primary_thread()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 389, in integrate_as_primary_thread
    self._perform_spawn(reply)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 411, in _perform_spawn
    reply.run()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 341, in run
    self._result = func(*args, **kwargs)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 1291, in executetask
    exec(co, loc)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/xdist/remote.py", line 393, in <module>
    config.hook.pytest_cmdline_main(config=config)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/main.py", line 330, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/main.py", line 337, in _main
    config.hook.pytest_runtestloop(session=session)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/xdist/remote.py", line 174, in pytest_runtestloop
    self.run_one_test()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/xdist/remote.py", line 195, in run_one_test
    self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 113, in pytest_runtest_protocol
    runtestprotocol(item, nextitem=nextitem)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 132, in runtestprotocol
    reports.append(call_and_report(item, "call", log))
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 241, in call_and_report
    call = CallInfo.from_call(
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 341, in from_call
    result: TResult | None = func()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 242, in <lambda>
    lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 174, in pytest_runtest_call
    item.runtest()
  File "/workspaces/mypy/mypy/test/data.py", line 323, in runtest
    suite.run_case(self)
  File "/workspaces/mypy/mypy/test/testcheck.py", line 85, in run_case
    self.run_case_once(testcase)
  File "/workspaces/mypy/mypy/test/testcheck.py", line 165, in run_case_once
    res = build.build(sources=sources, options=options, alt_lib_path=test_temp_dir)
  File "/workspaces/mypy/mypy/build.py", line 191, in build
    result = _build(
  File "/workspaces/mypy/mypy/build.py", line 267, in _build
    graph = dispatch(sources, manager, stdout)
  File "/workspaces/mypy/mypy/build.py", line 2939, in dispatch
    process_graph(graph, manager)
  File "/workspaces/mypy/mypy/build.py", line 3337, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/workspaces/mypy/mypy/build.py", line 3438, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/workspaces/mypy/mypy/build.py", line 2311, in type_check_first_pass
    self.type_checker().check_first_pass()
  File "/workspaces/mypy/mypy/checker.py", line 472, in check_first_pass
    self.accept(d)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 1200, in accept
    return visitor.visit_class_def(self)
  File "/workspaces/mypy/mypy/checker.py", line 2536, in visit_class_def
    self.accept(defn.defs)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 1281, in accept
    return visitor.visit_block(self)
  File "/workspaces/mypy/mypy/checker.py", line 3025, in visit_block
    self.accept(s)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 813, in accept
    return visitor.visit_func_def(self)
  File "/workspaces/mypy/mypy/checker.py", line 1129, in visit_func_def
    self._visit_func_def(defn)
  File "/workspaces/mypy/mypy/checker.py", line 1133, in _visit_func_def
    self.check_func_item(defn, name=defn.name)
  File "/workspaces/mypy/mypy/checker.py", line 1168, in check_func_item
    self.check_func_def(defn, typ, name, allow_empty)
  File "/workspaces/mypy/mypy/checker.py", line 1455, in check_func_def
    self.accept(item.body)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 1281, in accept
    return visitor.visit_block(self)
  File "/workspaces/mypy/mypy/checker.py", line 3025, in visit_block
    self.accept(s)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 1301, in accept
    return visitor.visit_expression_stmt(self)
  File "/workspaces/mypy/mypy/checker.py", line 4711, in visit_expression_stmt
    expr_type = self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
  File "/workspaces/mypy/mypy/checkexpr.py", line 5998, in accept
    typ = self.visit_call_expr(node, allow_none_return=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 488, in visit_call_expr
    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 622, in visit_call_expr_inner
    ret_type = self.check_call_expr_with_callee_type(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 1504, in check_call_expr_with_callee_type
    ret_type, callee_type = self.check_call(
                            ^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 1621, in check_call
    return self.check_any_type_call(args, callee, arg_kinds, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 3335, in check_any_type_call
    self.check_args_unpacking(arg_types, arg_kinds, context)
  File "/workspaces/mypy/mypy/checkexpr.py", line 3353, in check_args_unpacking
    if arg_kind == nodes.ARG_STAR2 and not self.is_valid_keyword_var_arg(arg_type):
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 6059, in is_valid_keyword_var_arg
    self.chk.named_generic_type(
  File "/workspaces/mypy/mypy/checker.py", line 7262, in named_generic_type
    info = self.lookup_typeinfo(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checker.py", line 7269, in lookup_typeinfo
    sym = self.lookup_qualified(fullname)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checker.py", line 7347, in lookup_qualified
    n = self.modules[parts[0]]
        ~~~~~~~~~~~~^^^^^^^^^^
KeyError: '_typeshed'
------------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------------
main:8: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://git.1-hub.cnpython/mypy/issues
version: 1.16.0+dev.96d250cf94c217f05f6de17df7f2f236e222d23b
main:8: : note: use --pdb to drop into pdb
_____________________________________________________________________ testInitSubclassUnannotated ______________________________________________________________________
[gw9] linux -- Python 3.12.9 /workspaces/mypy/venv/bin/python
data: /workspaces/mypy/test-data/unit/check-classes.test:7415:
SystemExit: 2
------------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 8, in <module>
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 1806, in serve
    WorkerGateway(io=io, id=id, _startcount=2).serve()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 1273, in serve
    self._execpool.integrate_as_primary_thread()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 389, in integrate_as_primary_thread
    self._perform_spawn(reply)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 411, in _perform_spawn
    reply.run()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 341, in run
    self._result = func(*args, **kwargs)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/execnet/gateway_base.py", line 1291, in executetask
    exec(co, loc)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/xdist/remote.py", line 393, in <module>
    config.hook.pytest_cmdline_main(config=config)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/main.py", line 330, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/main.py", line 337, in _main
    config.hook.pytest_runtestloop(session=session)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/xdist/remote.py", line 174, in pytest_runtestloop
    self.run_one_test()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/xdist/remote.py", line 195, in run_one_test
    self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 113, in pytest_runtest_protocol
    runtestprotocol(item, nextitem=nextitem)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 132, in runtestprotocol
    reports.append(call_and_report(item, "call", log))
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 241, in call_and_report
    call = CallInfo.from_call(
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 341, in from_call
    result: TResult | None = func()
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 242, in <lambda>
    lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/workspaces/mypy/venv/lib/python3.12/site-packages/_pytest/runner.py", line 174, in pytest_runtest_call
    item.runtest()
  File "/workspaces/mypy/mypy/test/data.py", line 323, in runtest
    suite.run_case(self)
  File "/workspaces/mypy/mypy/test/testcheck.py", line 85, in run_case
    self.run_case_once(testcase)
  File "/workspaces/mypy/mypy/test/testcheck.py", line 165, in run_case_once
    res = build.build(sources=sources, options=options, alt_lib_path=test_temp_dir)
  File "/workspaces/mypy/mypy/build.py", line 191, in build
    result = _build(
  File "/workspaces/mypy/mypy/build.py", line 267, in _build
    graph = dispatch(sources, manager, stdout)
  File "/workspaces/mypy/mypy/build.py", line 2939, in dispatch
    process_graph(graph, manager)
  File "/workspaces/mypy/mypy/build.py", line 3337, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/workspaces/mypy/mypy/build.py", line 3438, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/workspaces/mypy/mypy/build.py", line 2311, in type_check_first_pass
    self.type_checker().check_first_pass()
  File "/workspaces/mypy/mypy/checker.py", line 472, in check_first_pass
    self.accept(d)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 1200, in accept
    return visitor.visit_class_def(self)
  File "/workspaces/mypy/mypy/checker.py", line 2536, in visit_class_def
    self.accept(defn.defs)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 1281, in accept
    return visitor.visit_block(self)
  File "/workspaces/mypy/mypy/checker.py", line 3025, in visit_block
    self.accept(s)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 813, in accept
    return visitor.visit_func_def(self)
  File "/workspaces/mypy/mypy/checker.py", line 1129, in visit_func_def
    self._visit_func_def(defn)
  File "/workspaces/mypy/mypy/checker.py", line 1133, in _visit_func_def
    self.check_func_item(defn, name=defn.name)
  File "/workspaces/mypy/mypy/checker.py", line 1168, in check_func_item
    self.check_func_def(defn, typ, name, allow_empty)
  File "/workspaces/mypy/mypy/checker.py", line 1455, in check_func_def
    self.accept(item.body)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 1281, in accept
    return visitor.visit_block(self)
  File "/workspaces/mypy/mypy/checker.py", line 3025, in visit_block
    self.accept(s)
  File "/workspaces/mypy/mypy/checker.py", line 579, in accept
    stmt.accept(self)
  File "/workspaces/mypy/mypy/nodes.py", line 1301, in accept
    return visitor.visit_expression_stmt(self)
  File "/workspaces/mypy/mypy/checker.py", line 4711, in visit_expression_stmt
    expr_type = self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
  File "/workspaces/mypy/mypy/checkexpr.py", line 5998, in accept
    typ = self.visit_call_expr(node, allow_none_return=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 488, in visit_call_expr
    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 622, in visit_call_expr_inner
    ret_type = self.check_call_expr_with_callee_type(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 1504, in check_call_expr_with_callee_type
    ret_type, callee_type = self.check_call(
                            ^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 1621, in check_call
    return self.check_any_type_call(args, callee, arg_kinds, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 3335, in check_any_type_call
    self.check_args_unpacking(arg_types, arg_kinds, context)
  File "/workspaces/mypy/mypy/checkexpr.py", line 3353, in check_args_unpacking
    if arg_kind == nodes.ARG_STAR2 and not self.is_valid_keyword_var_arg(arg_type):
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checkexpr.py", line 6059, in is_valid_keyword_var_arg
    self.chk.named_generic_type(
  File "/workspaces/mypy/mypy/checker.py", line 7262, in named_generic_type
    info = self.lookup_typeinfo(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checker.py", line 7269, in lookup_typeinfo
    sym = self.lookup_qualified(fullname)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/mypy/mypy/checker.py", line 7347, in lookup_qualified
    n = self.modules[parts[0]]
        ~~~~~~~~~~~~^^^^^^^^^^
KeyError: '_typeshed'
------------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------------
main:3: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://git.1-hub.cnpython/mypy/issues
version: 1.16.0+dev.96d250cf94c217f05f6de17df7f2f236e222d23b
main:3: : note: use --pdb to drop into pdb
======================================================================= short test summary info ========================================================================
FAILED mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testInitSubclassUnannotatedMulti
FAILED mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testInitSubclassUnannotated
=============================================================== 2 failed, 566 passed, 1 xfailed in 2.19s ===============================================================
(venv) vscode ➜ /workspaces/mypy (missing-args-callable) $ pytest mypy/test/testcheck.py::TypeCheckSuite::check-classes.test --show-traceback
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --show-traceback
  inifile: /workspaces/mypy/pyproject.toml
  rootdir: /workspaces/mypy

(venv) vscode ➜ /workspaces/mypy (missing-args-callable) $ pytest --show-traceback mypy/test/testcheck.py::TypeCheckSuite::check-classes.test
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --show-traceback
  inifile: /workspaces/mypy/pyproject.toml
  rootdir: /workspaces/mypy

(venv) vscode ➜ /workspaces/mypy (missing-args-callable) $ mypy mypy/test/testcheck.py::TypeCheckSuite
mypy: can't read file 'mypy/test/testcheck.py::TypeCheckSuite': No such file or directory
(venv) vscode ➜ /workspaces/mypy (missing-args-callable) $ mypy mypy/test/testcheck.py --show-traceback
mypy/bogus_type.py:27: error: Cannot assign multiple types to name "Bogus" without an explicit "Type[...]" annotation  [misc]
Found 1 error in 1 file (checked 1 source file)

Traceback

(venv) vscode ➜ /workspaces/mypy (missing-args-callable) $ mypy mypy/test/testcheck.py --show-traceback
mypy/bogus_type.py:27: error: Cannot assign multiple types to name "Bogus" without an explicit "Type[...]" annotation  [misc]
Found 1 error in 1 file (checked 1 source file)

To Reproduce

I ran
pytest mypy/test/testcheck.py::TypeCheckSuite::check-classes.test because that seems to be the only test file it's tripping on.

Your Environment

  • Mypy version used: 1.16.0
  • Mypy command-line flags: --show-traceback
  • Python version used: 3.12.9
  • Operating system and version: Mac OS Sequoia 15.3.1

Some extra context
This is something that occurred while trying to fix issue #18990 (refer to this PR). We only made changes to two files, and I'm kinda stumped trying to figure out how to troubleshoot this. I can't figure out if I've run into a bug or if I broke something, so I was hoping someone could take a look and tell me if something got screwed up in the process. Thanks!

@sterliakov sterliakov added bug mypy got something wrong topic-developer Issues relevant to mypy developers topic-tests and removed crash labels Apr 29, 2025
@sterliakov
Copy link
Collaborator

The easiest fix would be to import _typeshed in test-data/unit/fixtures/object_with_init_subclass.pyi.

We only have a handful of tests using it, so that shouldn't be too bad for test performance. This is not a bug with the test suite, but rather a limitation of our fixture-based approach to builtin selection. Not all builtin symbols are available in all tests, that's what [builtins fixtures/something.pyi] does in some tests.

@sterliakov sterliakov added the pending Issues that may be closed label Apr 29, 2025
@lesliehuh
Copy link
Author

that worked, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong pending Issues that may be closed topic-developer Issues relevant to mypy developers topic-tests
Projects
None yet
Development

No branches or pull requests

2 participants