To Reproduce
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
install .whl file in </install/prefix> using installer module
run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Expected Behavior
pytest should not fail.
Actual Behavior
Here is pytest output:
```console
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mypy-1.10.1-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mypy-1.10.1-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.2, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1
configfile: pyproject.toml
testpaths: mypy/test, mypyc/test
plugins: forked-1.6.0
collected 12054 items
mypy/test/meta/test_diff_helper.py .. [ 0%]
mypy/test/meta/test_parse_data.py FFFF [ 0%]
mypy/test/meta/test_update_data.py F [ 0%]
mypy/test/test_find_sources.py ......... [ 0%]
mypy/test/test_ref_info.py ..... [ 0%]
mypy/test/testapi.py .... [ 0%]
mypy/test/testargs.py .. [ 0%]
mypy/test/testcheck.py .............................................................................................................................................................. [ 1%]
..................................................................................................................................................................................... [ 3%]
..................................................................................................................................................................................... [ 4%]
..................................................................................................................................................................................... [ 6%]
..................................................................................................................x.................................................................. [ 7%]
..................................................................................................................................................................................... [ 9%]
..................................................................................................................................................................................... [ 10%]
..................................................................................................................................................................................... [ 12%]
..................................................................................................................................................................................... [ 13%]
..................................................................................................................................................................................... [ 15%]
..................................................................................................................................................................................... [ 16%]
..................................................................................................................................................................................... [ 18%]
.................................................................s..................................................................................................s................ [ 19%]
.................s................................................................................................................................................................... [ 21%]
..............................................................................................................ss................................s.................................... [ 22%]
..................................................................................................................................................................................... [ 24%]
.........................................s................................................................................................s.......................................... [ 25%]
..................................................................................................................................................................................... [ 27%]
..................................................................................................................................................................................... [ 28%]
.............................................................s....................................................................................................................... [ 30%]
..................................................................................................................................................................................... [ 31%]
..................................................................................................................................................................................... [ 33%]
..................................................................................................................................................................................... [ 34%]
..................................................................................................................................................................................... [ 36%]
..................................................................................................................................................................................... [ 37%]
............................................................................................s........................................................................................ [ 39%]
..................................................................................................................................................................................... [ 40%]
................................................................................................................s.................................................................... [ 42%]
...................................................................s.........................s...............................................................................s.....s. [ 43%]
s......................................................................................s....................................................................................s........ [ 45%]
..................................................................................................................................................................................... [ 46%]
............................xx....................................................................................................................................................... [ 48%]
..................................................................................................................................................................................... [ 49%]
..................................................................................................................................................................................... [ 51%]
..................................................................................................................................................................................... [ 52%]
......................x.............................................................................................................................................................. [ 54%]
..........................................................................................................................x.......................................................... [ 55%]
..................................................................................................................................................................................... [ 57%]
............ [ 57%]
mypy/test/testcmdline.py ..................................................................................................................................................... [ 58%]
mypy/test/testconstraints.py .......... [ 58%]
mypy/test/testdaemon.py ........................... [ 58%]
mypy/test/testdeps.py ............................................................................................................................................................... [ 60%]
....................................................................... [ 60%]
mypy/test/testdiff.py .......................................................................... [ 61%]
mypy/test/testerrorstream.py ... [ 61%]
mypy/test/testfinegrained.py ..s............s........s................................s...s.....ss..........................................s........................................ [ 62%]
..ssssssss...........s................s.................s..........................................................................s................................................. [ 64%]
........................................................................................................................................................................s............ [ 65%]
....................................................s.....................s..............................................s.........................................................s. [ 67%]
....................... [ 67%]
mypy/test/testfinegrainedcache.py .......s.s....s....s..s.ss..........s...s.s...ss...ssssss.sss.sssss..s......................s...ssss.s.ss.....ss....s......ssss..sss..sssssss...s.. [ 68%]
..................sssss...s.....s........s.s.................s..s..sss.sssssssssssss.ss.sssssssssssssssssssssssssssss..................s..sss..s.s................................... [ 69%]
..............sss.........sss..sssssssss.........s....ssssss.s...ss....ss..s........................................s.s.s.......s.sss.s........s....s..............s....s....s....... [ 71%]
..........................sss....ss........s.....s....s.ss......................s....ssssss.ssssssssss...........ss............s.......s..s...s.s.s.....ss..s............ssss........ [ 72%]
....ss......s...ssss.s.......... [ 73%]
mypy/test/testformatter.py .. [ 73%]
mypy/test/testfscache.py .... [ 73%]
mypy/test/testgraph.py .... [ 73%]
mypy/test/testinfer.py ......................... [ 73%]
mypy/test/testipc.py s... [ 73%]
mypy/test/testmerge.py ......................................s.... [ 73%]
mypy/test/testmodulefinder.py ................ [ 74%]
mypy/test/testmypyc.py . [ 74%]
mypy/test/testparse.py .............................................................................................................................................................. [ 75%]
.............................................................................sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 76%]
mypy/test/testpep561.py ................. [ 76%]
mypy/test/testpythoneval.py .......................................................................................x................................................................. [ 78%]
..... [ 78%]
mypy/test/testreports.py .. [ 78%]
mypy/test/testsemanal.py ............................................................................................................................................................ [ 79%]
..................................................................................................................................................................................... [ 80%]
..................................................................................................................................................................................... [ 82%]
...................................................... [ 82%]
mypy/test/testsolve.py ...................... [ 83%]
mypy/test/teststubgen.py ......s......................................................................................................................x....................ss........ [ 84%]
..................................................................................................................................................................................... [ 85%]
............ [ 85%]
mypy/test/teststubinfo.py . [ 85%]
mypy/test/teststubtest.py ...................................................... [ 86%]
mypy/test/testsubtypes.py ......................... [ 86%]
mypy/test/testtransform.py .......................................................................................................................................................... [ 87%]
................................................................................................................ [ 88%]
mypy/test/testtypegen.py .....................s..................................................... [ 89%]
mypy/test/testtypes.py .........................................................s.......s.................................................... [ 90%]
mypy/test/testutil.py ...... [ 90%]
mypyc/test/test_alwaysdefined.py .......... [ 90%]
mypyc/test/test_analysis.py ................ [ 90%]
mypyc/test/test_cheader.py . [ 90%]
mypyc/test/test_commandline.py .s.. [ 90%]
mypyc/test/test_emit.py ...... [ 90%]
mypyc/test/test_emitclass.py ... [ 90%]
mypyc/test/test_emitfunc.py ............................................................... [ 91%]
mypyc/test/test_emitwrapper.py .. [ 91%]
mypyc/test/test_exceptions.py ..................... [ 91%]
mypyc/test/test_external.py . [ 91%]
mypyc/test/test_irbuild.py .......................................................................................................................................................... [ 92%]
..................................................................................................................................................................................... [ 94%]
..................................................................................................................................................................... [ 95%]
mypyc/test/test_ircheck.py ............ [ 95%]
mypyc/test/test_literals.py ...... [ 95%]
mypyc/test/test_lowering.py ............ [ 95%]
mypyc/test/test_namegen.py .... [ 95%]
mypyc/test/test_optimizations.py ...................... [ 96%]
mypyc/test/test_pprint.py .... [ 96%]
mypyc/test/test_rarray.py ...... [ 96%]
mypyc/test/test_refcount.py ............................................................. [ 96%]
mypyc/test/test_run.py .............................................................................................................................................................. [ 97%]
................................................................................................................................................xx................................... [ 99%]
............................................. [ 99%]
mypyc/test/test_struct.py .... [ 99%]
mypyc/test/test_tuplename.py . [ 99%]
mypyc/test/test_typeops.py ............ [100%]
========================================================================================= FAILURES ==========================================================================================
_______________________________________________________________________ ParseTestDataSuite.test_bad_eq_version_check ________________________________________________________________________
self =
def test_bad_eq_version_check(self) -> None:
# Act
actual = _run_pytest(
"""
[case abc]
s: str
[out version==3.7]
abc
"""
)
# Assert
> assert "version==3.7 always false since minimum runtime version is (3, 8)" in actual.stdout
E AssertionError: assert 'version==3.7 always false since minimum runtime version is (3, 8)' in ''
E + where '' = PytestResult(input='[case abc]\ns: str\n[out version==3.7]\nabc\n', input_updated='[case abc]\ns: str\n[out version==3...e: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml\n rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1\n\n').stdout
mypy/test/meta/test_parse_data.py:73: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
>> /usr/bin/python3 -m pytest -n 0 -s mypy/test/testcheck.py::TypeCheckSuite::check-meta-454810c4-374d-4ed0-a69f-7496d7c10d06.test
NESTED PYTEST STDERR: ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
: __main__.py: error: unrecognized arguments: -n mypy/test/testcheck.py::TypeCheckSuite::check-meta-454810c4-374d-4ed0-a69f-7496d7c10d06.test
: inifile: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml
: rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1
:
Exit code 4 (0 attempts remaining)
_______________________________________________________________________ ParseTestDataSuite.test_bad_ge_version_check ________________________________________________________________________
self =
def test_bad_ge_version_check(self) -> None:
# Act
actual = _run_pytest(
"""
[case abc]
s: str
[out version>=3.8]
abc
"""
)
# Assert
> assert "version>=3.8 always true since minimum runtime version is (3, 8)" in actual.stdout
E AssertionError: assert 'version>=3.8 always true since minimum runtime version is (3, 8)' in ''
E + where '' = PytestResult(input='[case abc]\ns: str\n[out version>=3.8]\nabc\n', input_updated='[case abc]\ns: str\n[out version>=3...e: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml\n rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1\n\n').stdout
mypy/test/meta/test_parse_data.py:59: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
>> /usr/bin/python3 -m pytest -n 0 -s mypy/test/testcheck.py::TypeCheckSuite::check-meta-5dfd4080-53cd-471a-a42b-4d15a252b5f4.test
NESTED PYTEST STDERR: ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
: __main__.py: error: unrecognized arguments: -n mypy/test/testcheck.py::TypeCheckSuite::check-meta-5dfd4080-53cd-471a-a42b-4d15a252b5f4.test
: inifile: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml
: rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1
:
Exit code 4 (0 attempts remaining)
________________________________________________________________________ ParseTestDataSuite.test_parse_invalid_case _________________________________________________________________________
self =
def test_parse_invalid_case(self) -> None:
# Act
result = _run_pytest(
"""
[case abc]
s: str
[case foo-XFAIL]
s: str
"""
)
# Assert
> assert "Invalid testcase id 'foo-XFAIL'" in result.stdout
E assert "Invalid testcase id 'foo-XFAIL'" in ''
E + where '' = PytestResult(input='[case abc]\ns: str\n[case foo-XFAIL]\ns: str\n', input_updated='[case abc]\ns: str\n[case foo-XFAI...e: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml\n rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1\n\n').stdout
mypy/test/meta/test_parse_data.py:27: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
>> /usr/bin/python3 -m pytest -n 0 -s mypy/test/testcheck.py::TypeCheckSuite::check-meta-18f269fa-6498-4ce9-a65a-fafc707d96b2.test
NESTED PYTEST STDERR: ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
: __main__.py: error: unrecognized arguments: -n mypy/test/testcheck.py::TypeCheckSuite::check-meta-18f269fa-6498-4ce9-a65a-fafc707d96b2.test
: inifile: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml
: rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1
:
Exit code 4 (0 attempts remaining)
_______________________________________________________________________ ParseTestDataSuite.test_parse_invalid_section _______________________________________________________________________
self =
def test_parse_invalid_section(self) -> None:
# Act
result = _run_pytest(
"""
[case abc]
s: str
[unknownsection]
abc
"""
)
# Assert
expected_lineno = result.input.splitlines().index("[unknownsection]") + 1
expected = (
f".test:{expected_lineno}: Invalid section header [unknownsection] in case 'abc'"
)
> assert expected in result.stdout
E assert ".test:3: Invalid section header [unknownsection] in case 'abc'" in ''
E + where '' = PytestResult(input='[case abc]\ns: str\n[unknownsection]\nabc\n', input_updated='[case abc]\ns: str\n[unknownsection]\...e: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml\n rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1\n\n').stdout
mypy/test/meta/test_parse_data.py:45: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
>> /usr/bin/python3 -m pytest -n 0 -s mypy/test/testcheck.py::TypeCheckSuite::check-meta-8cdadb5b-dfbd-4826-b850-5a531a781af1.test
NESTED PYTEST STDERR: ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
: __main__.py: error: unrecognized arguments: -n mypy/test/testcheck.py::TypeCheckSuite::check-meta-8cdadb5b-dfbd-4826-b850-5a531a781af1.test
: inifile: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml
: rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1
:
Exit code 4 (0 attempts remaining)
_____________________________________________________________________________ UpdateDataSuite.test_update_data ______________________________________________________________________________
self =
def test_update_data(self) -> None:
# Note: We test multiple testcases rather than 'test case per test case'
# so we could also exercise rewriting multiple testcases at once.
result = _run_pytest_update_data(
"""
[case testCorrect]
s: str = 42 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
[case testWrong]
s: str = 42 # E: wrong error
[case testXfail-xfail]
s: str = 42 # E: wrong error
[case testWrongMultiline]
s: str = 42 # E: foo \
# N: bar
[case testMissingMultiline]
s: str = 42; i: int = 'foo'
[case testExtraneous]
s: str = 'foo' # E: wrong error
[case testExtraneousMultiline]
s: str = 'foo' # E: foo \
# E: bar
[case testExtraneousMultilineNonError]
s: str = 'foo' # W: foo \
# N: bar
[case testOutCorrect]
s: str = 42
[out]
main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
[case testOutWrong]
s: str = 42
[out]
main:1: error: foobar
[case testOutWrongIncremental]
s: str = 42
[out]
main:1: error: foobar
[out2]
main:1: error: foobar
[case testWrongMultipleFiles]
import a, b
s: str = 42 # E: foo
[file a.py]
s1: str = 42 # E: bar
[file b.py]
s2: str = 43 # E: baz
[builtins fixtures/list.pyi]
"""
)
# Assert
expected = dedent_docstring(
"""
[case testCorrect]
s: str = 42 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
[case testWrong]
s: str = 42 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
[case testXfail-xfail]
s: str = 42 # E: wrong error
[case testWrongMultiline]
s: str = 42 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
[case testMissingMultiline]
s: str = 42; i: int = 'foo' # E: Incompatible types in assignment (expression has type "int", variable has type "str") \\
# E: Incompatible types in assignment (expression has type "str", variable has type "int")
[case testExtraneous]
s: str = 'foo'
[case testExtraneousMultiline]
s: str = 'foo'
[case testExtraneousMultilineNonError]
s: str = 'foo'
[case testOutCorrect]
s: str = 42
[out]
main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
[case testOutWrong]
s: str = 42
[out]
main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
[case testOutWrongIncremental]
s: str = 42
[out]
main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
[out2]
main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
[case testWrongMultipleFiles]
import a, b
s: str = 42 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
[file a.py]
s1: str = 42 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
[file b.py]
s2: str = 43 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
[builtins fixtures/list.pyi]
"""
)
> assert result.input_updated == expected
E assert '[case testCo...s/list.pyi]\n' == '[case testCo...s/list.pyi]\n'
E
E Skipping 149 identical leading characters in diff, use -v to show
E - 42 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
E + 42 # E: wrong error
E
E [case testXfail-xfail]
E s: str = 42 # E: wrong error...
E
E ...Full output truncated (53 lines hidden), use '-vv' to show
mypy/test/meta/test_update_data.py:135: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
>> /usr/bin/python3 -m pytest -n 0 -s --update-data mypy/test/testcheck.py::TypeCheckSuite::check-meta-91507aee-9232-4c2e-870d-74c84377c60b.test
NESTED PYTEST STDERR: ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
: __main__.py: error: unrecognized arguments: -n mypy/test/testcheck.py::TypeCheckSuite::check-meta-91507aee-9232-4c2e-870d-74c84377c60b.test
: inifile: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml
: rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1
:
Exit code 4 (2 attempts remaining)
>> /usr/bin/python3 -m pytest -n 0 -s --update-data mypy/test/testcheck.py::TypeCheckSuite::check-meta-91507aee-9232-4c2e-870d-74c84377c60b.test
NESTED PYTEST STDERR: ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
: __main__.py: error: unrecognized arguments: -n mypy/test/testcheck.py::TypeCheckSuite::check-meta-91507aee-9232-4c2e-870d-74c84377c60b.test
: inifile: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml
: rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1
:
Exit code 4 (1 attempts remaining)
>> /usr/bin/python3 -m pytest -n 0 -s --update-data mypy/test/testcheck.py::TypeCheckSuite::check-meta-91507aee-9232-4c2e-870d-74c84377c60b.test
NESTED PYTEST STDERR: ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
: __main__.py: error: unrecognized arguments: -n mypy/test/testcheck.py::TypeCheckSuite::check-meta-91507aee-9232-4c2e-870d-74c84377c60b.test
: inifile: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/pyproject.toml
: rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1
:
Exit code 4 (0 attempts remaining)
========================================================================================= XFAILURES =========================================================================================
________________________________________________________________________________ testOpWithInheritedFromAny _________________________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-classes.test:7432:
Failed: Unexpected type checker output (/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-classes.test, line 7432)
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Expected:
main:10: note: Revealed type is "Any"
main:12: note: Revealed type is "Any" (diff)
main:13: note: Revealed type is "Any"
main:14: note: Revealed type is "builtins.str"
main:15: note: Revealed type is "Any"
main:18: note: Revealed type is "Any" (diff)
main:19: note: Revealed type is "__main__.D1"
Actual:
main:10: note: Revealed type is "Any"
main:12: note: Revealed type is "builtins.float" (diff)
main:13: note: Revealed type is "Any"
main:14: note: Revealed type is "builtins.str"
main:15: note: Revealed type is "Any"
main:18: note: Revealed type is "builtins.float" (diff)
main:19: note: Revealed type is "__main__.D1"
Alignment of first line difference:
E: ...ote: Revealed type is "Any"
A: ...ote: Revealed type is "builtins.float"
^
Update the test output using --update-data -n0 (you can additionally use the -k selector to update only specific tests)
______________________________________________________________________ testImplementationHasSameDispatchTypeAsFallback ______________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-singledispatch.test:56:
Failed: Unexpected type checker output (/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-singledispatch.test, line 56)
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Expected:
main:5: error: singledispatch implementation 1 will never be used: implementation 2's dispatch type is the same (diff)
Actual:
Update the test output using --update-data -n0 (you can additionally use the -k selector to update only specific tests)
_______________________________________________________________________ testRegisterHasDifferentTypeThanTypeSignature _______________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-singledispatch.test:70:
Failed: Unexpected type checker output (/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-singledispatch.test, line 70)
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Expected:
main:8: error: Argument to register "str" is incompatible with type "int" in function signature (diff)
Actual:
Update the test output using --update-data -n0 (you can additionally use the -k selector to update only specific tests)
______________________________________________________________________________ testTypeGuardMultipleCondition _______________________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-typeguard.test:449:
Failed: Unexpected type checker output (/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-typeguard.test, line 449)
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Expected:
main:16: note: Revealed type is "__main__."
main:21: note: Revealed type is "__main__." (diff)
Actual:
main:16: note: Revealed type is "__main__."
main:21: note: Revealed type is "__main__.Bar" (diff)
Alignment of first line difference:
E: ...led type is "__main__."
A: ...led type is "__main__.Bar"
^
Update the test output using --update-data -n0 (you can additionally use the -k selector to update only specific tests)
_____________________________________________________________________ testImplicit604TypeAliasWithCyclicImportNotInStub _____________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-union-or-syntax.test:212:
Failed: Unexpected type checker output (/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/check-union-or-syntax.test, line 212)
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Expected:
main:3: note: Revealed type is "Union[builtins.str, was_mmap.mmap]" (diff)
Actual:
tmp/was_builtins.py:3: error: Unsupported left operand type for | ("Type[str]") (diff)
tmp/was_builtins.py:4: error: Variable "was_builtins.ReadableBuffer" is not valid as a type (diff)
tmp/was_builtins.py:4: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases (diff)
main:3: note: Revealed type is "ReadableBuffer?" (diff)
Alignment of first line difference:
E: main:3: note: Revealed type is "Union[builtins.str, was_mmap.mmap]"...
A: tmp/was_builtins.py:3: error: Unsupported left operand type for | ("Type...
^
Update the test output using --update-data -n0 (you can additionally use the -k selector to update only specific tests)
_______________________________________________________________________________ testAsyncioGatherPreciseType ________________________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/pythoneval.test:1157:
Failed: Invalid output (/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/pythoneval.test, line 1157)
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Expected:
_testAsyncioGatherPreciseType.py:9: note: Revealed type is "builtins.str" (diff)
_testAsyncioGatherPreciseType.py:10: note: Revealed type is "builtins.str"
_testAsyncioGatherPreciseType.py:11: note: Revealed type is "asyncio.futures.Future[builtins.list[Any]]" (diff)
Actual:
_testAsyncioGatherPreciseType.py:10: note: Revealed type is "builtins.str"
_testAsyncioGatherPreciseType.py:11: note: Revealed type is "builtins.str" (diff)
_testAsyncioGatherPreciseType.py:12: note: Revealed type is "asyncio.futures.Future[builtins.list[None]]" (diff)
Alignment of first line difference:
E: ...ioGatherPreciseType.py:9: note: Revealed type is "builtins.str"
A: ...ioGatherPreciseType.py:10: note: Revealed type is "builtins.str"
^
Update the test output using --update-data -n0 (you can additionally use the -k selector to update only specific tests)
____________________________________________________________________________ testNestedClassInNamedTuple_semanal ____________________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/stubgen.test:955:
Failed: Invalid output (/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/test-data/unit/stubgen.test, line 955)
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Expected:
from typing import NamedTuple
class NamedTupleWithNestedClass(NamedTuple): (diff)
class Nested: (diff)
x: int (diff)
y: str (diff)
Actual:
from typing import NamedTuple
class NamedTupleWithNestedClass(NamedTuple): ... (diff)
Alignment of first line difference:
E: ...NestedClass(NamedTuple):
A: ...NestedClass(NamedTuple): ...
^
Update the test output using --update-data -n0 (you can additionally use the -k selector to update only specific tests)
_________________________________________________________________________________ testSingleDispatchMethod __________________________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test-data/run-singledispatch.test:195:
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test/test_run.py:234: in run_case_step
result = emitmodule.parse_and_typecheck(
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/codegen/emitmodule.py:197: in parse_and_typecheck
raise CompileError(result.errors)
E mypy.errors.CompileError: native.py:1: error: Module "functools" has no attribute "singledispatchmethod"; maybe "singledispatch"? [attr-defined]
During handling of the above exception, another exception occurred:
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test/test_run.py:148: in run_case
self.run_case_inner(testcase)
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test/test_run.py:164: in run_case_inner
self.run_case_step(testcase, step)
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test/test_run.py:251: in run_case_step
assert False, "Compile error"
E AssertionError: Compile error
E assert False
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
run-singledispatch.test:196: error: Module "functools" has no attribute "singledispatchmethod"; maybe "singledispatch"? [attr-defined]
________________________________________________________________________ testSingleDispatchMethodWithOtherDecorator _________________________________________________________________________
data: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test-data/run-singledispatch.test:216:
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test/test_run.py:234: in run_case_step
result = emitmodule.parse_and_typecheck(
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/codegen/emitmodule.py:197: in parse_and_typecheck
raise CompileError(result.errors)
E mypy.errors.CompileError: native.py:1: error: Module "functools" has no attribute "singledispatchmethod"; maybe "singledispatch"? [attr-defined]
During handling of the above exception, another exception occurred:
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test/test_run.py:148: in run_case
self.run_case_inner(testcase)
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test/test_run.py:164: in run_case_inner
self.run_case_step(testcase, step)
/home/tkloczko/rpmbuild/BUILD/mypy-1.10.1/mypyc/test/test_run.py:251: in run_case_step
assert False, "Compile error"
E AssertionError: Compile error
E assert False
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
run-singledispatch.test:217: error: Module "functools" has no attribute "singledispatchmethod"; maybe "singledispatch"? [attr-defined]
================================================================================== short test summary info ==================================================================================
SKIPPED [33] mypy/test/data.py:311: Skipped
SKIPPED [223] mypy/test/testfinegrained.py:76: Skipped
SKIPPED [1] mypy/test/testipc.py:104: unconditional skip
SKIPPED [71] mypy/test/testparse.py:87: Skipped
SKIPPED [1] mypy/test/teststubgen.py:597: Tests building the paths common ancestor on Windows
SKIPPED [2] mypy/test/teststubgen.py:704: Skipped
SKIPPED [1] mypy/test/testtypes.py:923: unconditional skip
SKIPPED [1] mypy/test/testtypes.py:915: unconditional skip
XFAIL mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testOpWithInheritedFromAny
XFAIL mypy/test/testcheck.py::TypeCheckSuite::check-singledispatch.test::testImplementationHasSameDispatchTypeAsFallback
XFAIL mypy/test/testcheck.py::TypeCheckSuite::check-singledispatch.test::testRegisterHasDifferentTypeThanTypeSignature
XFAIL mypy/test/testcheck.py::TypeCheckSuite::check-typeguard.test::testTypeGuardMultipleCondition
XFAIL mypy/test/testcheck.py::TypeCheckSuite::check-union-or-syntax.test::testImplicit604TypeAliasWithCyclicImportNotInStub
XFAIL mypy/test/testpythoneval.py::PythonEvaluationSuite::pythoneval.test::testAsyncioGatherPreciseType
XFAIL mypy/test/teststubgen.py::StubgenPythonSuite::stubgen.test::testNestedClassInNamedTuple_semanal
XFAIL mypyc/test/test_run.py::TestRun::run-singledispatch.test::testSingleDispatchMethod
XFAIL mypyc/test/test_run.py::TestRun::run-singledispatch.test::testSingleDispatchMethodWithOtherDecorator
FAILED mypy/test/meta/test_parse_data.py::ParseTestDataSuite::test_bad_eq_version_check - AssertionError: assert 'version==3.7 always false since minimum runtime version is (3, 8)' in ''
FAILED mypy/test/meta/test_parse_data.py::ParseTestDataSuite::test_bad_ge_version_check - AssertionError: assert 'version>=3.8 always true since minimum runtime version is (3, 8)' in ''
FAILED mypy/test/meta/test_parse_data.py::ParseTestDataSuite::test_parse_invalid_case - assert "Invalid testcase id 'foo-XFAIL'" in ''
FAILED mypy/test/meta/test_parse_data.py::ParseTestDataSuite::test_parse_invalid_section - assert ".test:3: Invalid section header [unknownsection] in case 'abc'" in ''
FAILED mypy/test/meta/test_update_data.py::UpdateDataSuite::test_update_data - assert '[case testCo...s/list.pyi]\n' == '[case testCo...s/list.pyi]\n'
=========================================================== 5 failed, 11707 passed, 333 skipped, 9 xfailed in 4772.95s (1:19:32) ============================================================
```
Your Environment
Mypy version used: 1.10.1
Mypy command-line flags: N/A
Mypy configuration options from mypy.ini (and other config files): N/A
Bug Report Looks like pytest fails in few units.
To Reproduce I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesinstaller
modulecut off from access to the public network
(pytest is executed with-m "not network"
)Expected Behavior pytest should not fail.
Actual Behavior
Here is pytest output:
```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mypy-1.10.1-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mypy-1.10.1-2.fc37.x86_64/usr/lib/python3.10/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.10.14, pytest-8.2.2, pluggy-1.5.0 rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.10.1 configfile: pyproject.toml testpaths: mypy/test, mypyc/test plugins: forked-1.6.0 collected 12054 items mypy/test/meta/test_diff_helper.py .. [ 0%] mypy/test/meta/test_parse_data.py FFFF [ 0%] mypy/test/meta/test_update_data.py F [ 0%] mypy/test/test_find_sources.py ......... [ 0%] mypy/test/test_ref_info.py ..... [ 0%] mypy/test/testapi.py .... [ 0%] mypy/test/testargs.py .. [ 0%] mypy/test/testcheck.py .............................................................................................................................................................. [ 1%] ..................................................................................................................................................................................... [ 3%] ..................................................................................................................................................................................... [ 4%] ..................................................................................................................................................................................... [ 6%] ..................................................................................................................x.................................................................. [ 7%] ..................................................................................................................................................................................... [ 9%] ..................................................................................................................................................................................... [ 10%] ..................................................................................................................................................................................... [ 12%] ..................................................................................................................................................................................... [ 13%] ..................................................................................................................................................................................... [ 15%] ..................................................................................................................................................................................... [ 16%] ..................................................................................................................................................................................... [ 18%] .................................................................s..................................................................................................s................ [ 19%] .................s................................................................................................................................................................... [ 21%] ..............................................................................................................ss................................s.................................... [ 22%] ..................................................................................................................................................................................... [ 24%] .........................................s................................................................................................s.......................................... [ 25%] ..................................................................................................................................................................................... [ 27%] ..................................................................................................................................................................................... [ 28%] .............................................................s....................................................................................................................... [ 30%] ..................................................................................................................................................................................... [ 31%] ..................................................................................................................................................................................... [ 33%] ..................................................................................................................................................................................... [ 34%] ..................................................................................................................................................................................... [ 36%] ..................................................................................................................................................................................... [ 37%] ............................................................................................s........................................................................................ [ 39%] ..................................................................................................................................................................................... [ 40%] ................................................................................................................s.................................................................... [ 42%] ...................................................................s.........................s...............................................................................s.....s. [ 43%] s......................................................................................s....................................................................................s........ [ 45%] ..................................................................................................................................................................................... [ 46%] ............................xx....................................................................................................................................................... [ 48%] ..................................................................................................................................................................................... [ 49%] ..................................................................................................................................................................................... [ 51%] ..................................................................................................................................................................................... [ 52%] ......................x.............................................................................................................................................................. [ 54%] ..........................................................................................................................x.......................................................... [ 55%] ..................................................................................................................................................................................... [ 57%] ............ [ 57%] mypy/test/testcmdline.py ..................................................................................................................................................... [ 58%] mypy/test/testconstraints.py .......... [ 58%] mypy/test/testdaemon.py ........................... [ 58%] mypy/test/testdeps.py ............................................................................................................................................................... [ 60%] ....................................................................... [ 60%] mypy/test/testdiff.py .......................................................................... [ 61%] mypy/test/testerrorstream.py ... [ 61%] mypy/test/testfinegrained.py ..s............s........s................................s...s.....ss..........................................s........................................ [ 62%] ..ssssssss...........s................s.................s..........................................................................s................................................. [ 64%] ........................................................................................................................................................................s............ [ 65%] ....................................................s.....................s..............................................s.........................................................s. [ 67%] ....................... [ 67%] mypy/test/testfinegrainedcache.py .......s.s....s....s..s.ss..........s...s.s...ss...ssssss.sss.sssss..s......................s...ssss.s.ss.....ss....s......ssss..sss..sssssss...s.. [ 68%] ..................sssss...s.....s........s.s.................s..s..sss.sssssssssssss.ss.sssssssssssssssssssssssssssss..................s..sss..s.s................................... [ 69%] ..............sss.........sss..sssssssss.........s....ssssss.s...ss....ss..s........................................s.s.s.......s.sss.s........s....s..............s....s....s....... [ 71%] ..........................sss....ss........s.....s....s.ss......................s....ssssss.ssssssssss...........ss............s.......s..s...s.s.s.....ss..s............ssss........ [ 72%] ....ss......s...ssss.s.......... [ 73%] mypy/test/testformatter.py .. [ 73%] mypy/test/testfscache.py .... [ 73%] mypy/test/testgraph.py .... [ 73%] mypy/test/testinfer.py ......................... [ 73%] mypy/test/testipc.py s... [ 73%] mypy/test/testmerge.py ......................................s.... [ 73%] mypy/test/testmodulefinder.py ................ [ 74%] mypy/test/testmypyc.py . [ 74%] mypy/test/testparse.py .............................................................................................................................................................. [ 75%] .............................................................................sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 76%] mypy/test/testpep561.py ................. [ 76%] mypy/test/testpythoneval.py .......................................................................................x................................................................. [ 78%] ..... [ 78%] mypy/test/testreports.py .. [ 78%] mypy/test/testsemanal.py ............................................................................................................................................................ [ 79%] ..................................................................................................................................................................................... [ 80%] ..................................................................................................................................................................................... [ 82%] ...................................................... [ 82%] mypy/test/testsolve.py ...................... [ 83%] mypy/test/teststubgen.py ......s......................................................................................................................x....................ss........ [ 84%] ..................................................................................................................................................................................... [ 85%] ............ [ 85%] mypy/test/teststubinfo.py . [ 85%] mypy/test/teststubtest.py ...................................................... [ 86%] mypy/test/testsubtypes.py ......................... [ 86%] mypy/test/testtransform.py .......................................................................................................................................................... [ 87%] ................................................................................................................ [ 88%] mypy/test/testtypegen.py .....................s..................................................... [ 89%] mypy/test/testtypes.py .........................................................s.......s.................................................... [ 90%] mypy/test/testutil.py ...... [ 90%] mypyc/test/test_alwaysdefined.py .......... [ 90%] mypyc/test/test_analysis.py ................ [ 90%] mypyc/test/test_cheader.py . [ 90%] mypyc/test/test_commandline.py .s.. [ 90%] mypyc/test/test_emit.py ...... [ 90%] mypyc/test/test_emitclass.py ... [ 90%] mypyc/test/test_emitfunc.py ............................................................... [ 91%] mypyc/test/test_emitwrapper.py .. [ 91%] mypyc/test/test_exceptions.py ..................... [ 91%] mypyc/test/test_external.py . [ 91%] mypyc/test/test_irbuild.py .......................................................................................................................................................... [ 92%] ..................................................................................................................................................................................... [ 94%] ..................................................................................................................................................................... [ 95%] mypyc/test/test_ircheck.py ............ [ 95%] mypyc/test/test_literals.py ...... [ 95%] mypyc/test/test_lowering.py ............ [ 95%] mypyc/test/test_namegen.py .... [ 95%] mypyc/test/test_optimizations.py ...................... [ 96%] mypyc/test/test_pprint.py .... [ 96%] mypyc/test/test_rarray.py ...... [ 96%] mypyc/test/test_refcount.py ............................................................. [ 96%] mypyc/test/test_run.py .............................................................................................................................................................. [ 97%] ................................................................................................................................................xx................................... [ 99%] ............................................. [ 99%] mypyc/test/test_struct.py .... [ 99%] mypyc/test/test_tuplename.py . [ 99%] mypyc/test/test_typeops.py ............ [100%] ========================================================================================= FAILURES ========================================================================================== _______________________________________________________________________ ParseTestDataSuite.test_bad_eq_version_check ________________________________________________________________________ self =Your Environment
mypy.ini
(and other config files): N/AList of installed modules in build env:
```console Package Version ----------------------------- ----------- alabaster 0.7.16 attrs 23.2.0 Babel 2.15.0 build 1.2.1 charset-normalizer 3.3.2 defusedxml 0.7.1 distlib 0.3.8 distro 1.9.0 docutils 0.20.1 exceptiongroup 1.1.3 filelock 3.15.4 flake8 7.1.0 flake8-bugbear 23.9.16 flake8-pyi 24.1.0 imagesize 1.4.1 importlib_metadata 7.2.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.4 lxml 5.2.2 MarkupSafe 2.1.5 mccabe 0.7.0 mypy_extensions 1.0.0 packaging 24.0 platformdirs 4.2.2 pluggy 1.5.0 psutil 6.0.0 py 1.11.0 pycodestyle 2.12.0 pyflakes 3.2.0 Pygments 2.18.0 pyproject_hooks 1.0.0 pytest 8.2.2 pytest-forked 1.6.0 python-dateutil 2.9.0.post0 requests 2.32.3 setuptools 69.4.0 snowballstemmer 2.2.0 Sphinx 7.3.7 sphinx_rtd_theme 2.0.0 sphinxcontrib-applehelp 1.0.8 sphinxcontrib-devhelp 1.0.6 sphinxcontrib-htmlhelp 2.0.5 sphinxcontrib-jquery 4.1 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.7 sphinxcontrib-serializinghtml 1.1.10 tokenize_rt 5.2.0 tomli 2.0.1 typing_extensions 4.12.2 urllib3 2.2.2 virtualenv 20.26.3 wheel 0.43.0 zipp 3.19.2 ```Please let me know if you need more details or want me to perform some diagnostics.