Skip to content

7.4.0: pytest is failing with internal error on testing mypy (possible bug in pytest?) #11201

Closed as not planned
@kloczek

Description

@kloczek
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

I'm packaging mypy as the 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")

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mypy-1.4.1-3.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mypy-1.4.1-3.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' -vvv
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/tkloczko/rpmbuild/BUILD/mypy-1.4.1
configfile: pytest.ini
testpaths: mypy/test, mypyc/test
plugins: cov-4.0.0, xdist-3.3.1, forked-1.6.0
24 workers [11206 items]
scheduling tests via LoadScheduling

mypy/test/test_find_sources.py::SourceFinderSuite::test_crawl_namespace
mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testTypeUsingTypeCInUpperBound <- test-data/unit/check-classes.test
[gw0] [  0%] PASSED mypy/test/test_find_sources.py::SourceFinderSuite::test_crawl_namespace
mypy/test/test_find_sources.py::SourceFinderSuite::test_crawl_namespace_explicit_base
[gw0] [  0%] PASSED mypy/test/test_find_sources.py::SourceFinderSuite::test_crawl_namespace_explicit_base
mypy/test/test_find_sources.py::SourceFinderSuite::test_crawl_namespace_multi_dir
mypy/test/testcheck.py::TypeCheckSuite::check-dynamic-typing.test::testImplicitGlobalFunctionSignature <- test-data/unit/check-dynamic-typing.test
mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFinalWithDunderAssignment <- test-data/unit/check-enum.test
mypy/test/testcheck.py::TypeCheckSuite::check-annotated.test::testAnnotatedAliasGenericUnion <- test-data/unit/check-annotated.test
mypy/test/testcheck.py::TypeCheckSuite::check-classes.test::testDescriptorDunderSetWrongArgTypes <- test-data/unit/check-classes.test
mypy/test/testcheck.py::TypeCheckSuite::check-columns.test::testColumnReturnValueExpected <- test-data/unit/check-columns.test
mypy/test/testcheck.py::TypeCheckSuite::check-bound.test::testBoundHigherOrderWithVoid <- test-data/unit/check-bound.test
[gw0] [  0%] PASSED mypy/test/test_find_sources.py::SourceFinderSuite::test_crawl_namespace_multi_dir
mypy/test/test_find_sources.py::SourceFinderSuite::test_crawl_no_namespace

[..]

[gw0] [ 67%] SKIPPED mypy/test/testfinegrainedcache.py::FineGrainedCacheSuite::fine-grained-follow-imports.test::testFollowImportsNormalAddSuppressed3_cached <- test-data/unit/fine-grained-follow-imports.test
mypy/test/testfinegrainedcache.py::FineGrainedCacheSuite::fine-grained-follow-imports.test::testFollowImportsNormalEditingFileBringNewModule_cached <- test-data/unit/fine-grained-follow-imports.test
INTERNALERROR> def worker_internal_error(self, node, formatted_error):
INTERNALERROR>         """
INTERNALERROR>         pytest_internalerror() was called on the worker.
INTERNALERROR>
INTERNALERROR>         pytest_internalerror() arguments are an excinfo and an excrepr, which can't
INTERNALERROR>         be serialized, so we go with a poor man's solution of raising an exception
INTERNALERROR>         here ourselves using the formatted message.
INTERNALERROR>         """
INTERNALERROR>         self._active_nodes.remove(node)
INTERNALERROR>         try:
INTERNALERROR> >           assert False, formatted_error
INTERNALERROR> E           AssertionError: Traceback (most recent call last):
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/_pytest/main.py", line 270, in wrap_session
INTERNALERROR> E                 session.exitstatus = doit(config, session) or 0
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/_pytest/main.py", line 324, in _main
INTERNALERROR> E                 config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> E                 return outcome.get_result()
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E                 raise ex[1].with_traceback(ex[2])
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/xdist/remote.py", line 157, in pytest_runtestloop
INTERNALERROR> E                 self.run_one_test()
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/xdist/remote.py", line 174, in run_one_test
INTERNALERROR> E                 self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> E                 return outcome.get_result()
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E                 raise ex[1].with_traceback(ex[2])
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/_pytest/runner.py", line 114, in pytest_runtest_protocol
INTERNALERROR> E                 runtestprotocol(item, nextitem=nextitem)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/_pytest/runner.py", line 133, in runtestprotocol
INTERNALERROR> E                 reports.append(call_and_report(item, "call", log))
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/_pytest/runner.py", line 224, in call_and_report
INTERNALERROR> E                 report: TestReport = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 55, in _multicall
INTERNALERROR> E                 gen.send(outcome)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/_pytest/skipping.py", line 266, in pytest_runtest_makereport
INTERNALERROR> E                 rep = outcome.get_result()
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E                 raise ex[1].with_traceback(ex[2])
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/_pytest/runner.py", line 368, in pytest_runtest_makereport
INTERNALERROR> E                 return TestReport.from_item_and_call(item, call)
INTERNALERROR> E               File "/usr/lib/python3.8/site-packages/_pytest/reports.py", line 362, in from_item_and_call
INTERNALERROR> E                 longrepr = item.repr_failure(excinfo)
INTERNALERROR> E               File "/home/tkloczko/rpmbuild/BUILD/mypy-1.4.1/mypy/test/data.py", line 392, in repr_failure
INTERNALERROR> E                 self.parent._prunetraceback(excinfo)
INTERNALERROR> E             AttributeError: 'DataFileCollector' object has no attribute '_prunetraceback'
INTERNALERROR> E           assert False
INTERNALERROR>
INTERNALERROR> /usr/lib/python3.8/site-packages/xdist/dsession.py:197: AssertionError
[gw21] [ 67%] PASSED mypy/test/testfinegrainedcache.py::FineGrainedCacheSuite::fine-grained.test::testMakeClassNoLongerAbstract1_cached <- test-data/unit/fine-grained.test
mypy/test/testfinegrainedcache.py::FineGrainedCacheSuite::fine-grained.test::testMakeClassNoLongerAbstract2_cached <- test-data/unit/fine-grained.test
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/_pytest/main.py", line 270, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/_pytest/main.py", line 324, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/xdist/dsession.py", line 122, in pytest_runtestloop
INTERNALERROR>     self.loop_once()
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/xdist/dsession.py", line 145, in loop_once
INTERNALERROR>     call(**kwargs)
INTERNALERROR>   File "/usr/lib/python3.8/site-packages/xdist/dsession.py", line 184, in worker_workerfinished
INTERNALERROR>     assert not crashitem, (crashitem, node)
INTERNALERROR> AssertionError: ('mypy/test/testpep561.py::PEP561Suite::pep561.test::testTypedPkg_config_nositepackages', <WorkerController gw9>)
INTERNALERROR> assert not 'mypy/test/testpep561.py::PEP561Suite::pep561.test::testTypedPkg_config_nositepackages'

======================================================================= 7476 passed, 133 skipped, 6 xfailed in 43.78s =======================================================================

Here is list of installed modules in build env

Package                       Version
----------------------------- -------
alabaster                     0.7.13
ast_decompiler                0.7.0
asttokens                     2.2.1
attrs                         23.1.0
Babel                         2.12.1
backcall                      0.2.0
build                         0.10.0
charset-normalizer            3.1.0
coverage                      7.2.7
decorator                     5.1.1
distlib                       0.3.6
distro                        1.8.0
docutils                      0.19
exceptiongroup                1.1.1
execnet                       1.9.0
executing                     1.2.0
filelock                      3.12.2
flake8                        5.0.4
flake8-bugbear                22.7.1
flake8-pyi                    22.11.0
gpg                           1.20.0
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.7.0
iniconfig                     2.0.0
installer                     0.7.0
ipython                       8.12.0
jedi                          0.18.2
Jinja2                        3.1.2
libcomps                      0.1.19
lxml                          4.9.3
MarkupSafe                    2.1.2
matplotlib-inline             0.1.6
mccabe                        0.7.0
mypy-extensions               1.0.0
packaging                     23.1
parso                         0.8.3
pexpect                       4.8.0
pickleshare                   0.7.5
platformdirs                  3.8.1
pluggy                        1.0.0
prompt-toolkit                3.0.38
psutil                        5.9.2
ptyprocess                    0.7.0
pure-eval                     0.2.2
py                            1.11.0
pycodestyle                   2.9.1
pyflakes                      2.5.0
Pygments                      2.15.1
pyproject_hooks               1.0.0
pytest                        7.4.0
pytest-cov                    4.0.0
pytest-forked                 1.6.0
pytest-xdist                  3.3.1
python-dateutil               2.8.2
pytz                          2023.2
requests                      2.31.0
setuptools                    68.0.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        6.2.1
sphinx-rtd-theme              1.2.1
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jquery          4.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
stack-data                    0.6.2
tomli                         2.0.1
traitlets                     5.9.0
typed-ast                     1.5.4
typing_extensions             4.7.1
urllib3                       1.26.15
virtualenv                    20.23.1
wcwidth                       0.2.6
wheel                         0.40.0
zipp                          3.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions