I'm running tests for 1.9.0 and I found that the StubtestUnit.test_runtime_typing_objects test fails.
To Reproduce
Run tests.
Expected Behavior
All tests pass.
Actual Behavior
___________________ StubtestUnit.test_runtime_typing_objects ___________________
[gw1] sunos5 -- Python 3.9.18 $(BUILD_DIR)/.tox/py39/bin/python
args = (<mypy.test.teststubtest.StubtestUnit testMethod=test_runtime_typing_objects>,)
kwargs = {}
cases = [<mypy.test.teststubtest.Case object at 0x7fffacfaf550>, <mypy.test.teststubtest.Case object at 0x7fffacfaff10>, <mypy.test.teststubtest.Case object at 0x7fffacfaff40>]
expected_errors = set()
c = <mypy.test.teststubtest.Case object at 0x7fffacfaff40>, @py_assert1 = False
@py_format3 = "{'test_module.Y.__closed__', 'test_module.Y.__extra_items__'} == set()\n~\n~Extra items in the left set:\n~'test_modu...__'\n~\n~Full diff:\n~- set()\n~+ {\n~+ 'test_module.Y.__closed__',\n~+ 'test_module.Y.__extra_items__',\n~+ }"
@py_format5 = "error: test_module.Y.__closed__ is not present in stub\n~Stub: in file test_module.pyi\n~MISSING\n~Runtime:\n~False\n...__'\n~\n~Full diff:\n~- set()\n~+ {\n~+ 'test_module.Y.__closed__',\n~+ 'test_module.Y.__extra_items__',\n~+ }"
output = 'error: test_module.Y.__closed__ is not present in stub\nStub: in file test_module.pyi\nMISSING\nRuntime:\nFalse\n\ner... is not present in stub\nStub: in file test_module.pyi\nMISSING\nRuntime:\nNone\n\nFound 2 errors (checked 1 module)\n'
actual_errors = {'test_module.Y.__closed__', 'test_module.Y.__extra_items__'}
def test(*args: Any, **kwargs: Any) -> None:
cases = list(fn(*args, **kwargs))
expected_errors = set()
for c in cases:
if c.error is None:
continue
expected_error = c.error
if expected_error == "":
expected_error = TEST_MODULE_NAME
elif not expected_error.startswith(f"{TEST_MODULE_NAME}."):
expected_error = f"{TEST_MODULE_NAME}.{expected_error}"
assert expected_error not in expected_errors, (
"collect_cases merges cases into a single stubtest invocation; we already "
"expect an error for {}".format(expected_error)
)
expected_errors.add(expected_error)
output = run_stubtest(
stub="\n\n".join(textwrap.dedent(c.stub.lstrip("\n")) for c in cases),
runtime="\n\n".join(textwrap.dedent(c.runtime.lstrip("\n")) for c in cases),
options=["--generate-allowlist"],
)
actual_errors = set(output.splitlines())
if actual_errors != expected_errors:
output = run_stubtest(
stub="\n\n".join(textwrap.dedent(c.stub.lstrip("\n")) for c in cases),
runtime="\n\n".join(textwrap.dedent(c.runtime.lstrip("\n")) for c in cases),
options=[],
)
> assert actual_errors == expected_errors, output
E AssertionError: error: test_module.Y.__closed__ is not present in stub
E Stub: in file test_module.pyi
E MISSING
E Runtime:
E False
E
E error: test_module.Y.__extra_items__ is not present in stub
E Stub: in file test_module.pyi
E MISSING
E Runtime:
E None
E
E Found 2 errors (checked 1 module)
E
E assert {'test_module.Y.__closed__', 'test_module.Y.__extra_items__'} == set()
E
E Extra items in the left set:
E 'test_module.Y.__closed__'
E 'test_module.Y.__extra_items__'
E
E Full diff:
E - set()
E + {
E + 'test_module.Y.__closed__',
E + 'test_module.Y.__extra_items__',
E + }
mypy/test/teststubtest.py:219: AssertionError
Your Environment
Mypy version used: 1.9.0
Mypy command-line flags: N/A
Mypy configuration options from mypy.ini (and other config files): N/A
Hello, we are also seeing this on Debian. I think typing-extensions 4.10.0 is to blame, because an earlier build I did locally with typing-extensions 4.9.0 didn't have this failure
(arguably the thing that is "to blame" here is the fact that mypy's test fixtures are overly coupled to the exact attributes that typing_extensions.TypedDict has at runtime ;)
Activity
JelleZijlstra commented on Mar 9, 2024
This probably depends on the version of typing-extensions you have installed.
mtelka commented on Mar 9, 2024
I tested with typing-extensions version 4.10.0.
mr-c commented on Mar 11, 2024
Hello, we are also seeing this on Debian. I think typing-extensions 4.10.0 is to blame, because an earlier build I did locally with typing-extensions 4.9.0 didn't have this failure
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1065805
mr-c commented on Mar 11, 2024
Cherry-picking eb84794 into the Debian package fixed the mypy tests for me.
AlexWaygood commented on Mar 11, 2024
(arguably the thing that is "to blame" here is the fact that mypy's test fixtures are overly coupled to the exact attributes that typing_extensions.TypedDict has at runtime ;)
mtelka commented on Apr 25, 2024
The test is passing with 1.10.0.