Skip to content
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

INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr' #515

Closed
lusewell opened this issue Mar 26, 2020 · 2 comments · Fixed by pytest-dev/pytest#6988
Closed

INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr' #515

lusewell opened this issue Mar 26, 2020 · 2 comments · Fixed by pytest-dev/pytest#6988

Comments

@lusewell
Copy link

Running pytest with -n4 and --doctest-modules together with import errors leads to this misleading error which hides what the actual error is.

(pytest-debug) :~/PycharmProjects/scratch$ py.test --pyargs test123 --doctest-modules -n4 
=================================================== test session starts ====================================================
platform linux -- Python 3.7.6, pytest-5.4.1.dev27+g3b48fce, py-1.8.1, pluggy-0.13.0
rootdir: ~/PycharmProjects/scratch
plugins: forked-1.1.3, xdist-1.31.1.dev1+g6fd5b56
gw0 ok / gw1 ok / gw2 C / gw3 CINTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "site-packages/pytest-5.4.1.dev27+g3b48fce-py3.7.egg/_pytest/main.py", line 191, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "site-packages/pytest-5.4.1.dev27+g3b48fce-py3.7.egg/_pytest/main.py", line 247, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "site-packages/pluggy/manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "site-packages/pluggy/manager.py", line 86, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "site-packages/pytest_xdist-1.31.1.dev1+g6fd5b56-py3.7.egg/xdist/dsession.py", line 112, in pytest_runtestloop
INTERNALERROR>     self.loop_once()
INTERNALERROR>   File "site-packages/pytest_xdist-1.31.1.dev1+g6fd5b56-py3.7.egg/xdist/dsession.py", line 135, in loop_once
INTERNALERROR>     call(**kwargs)
INTERNALERROR>   File "site-packages/pytest_xdist-1.31.1.dev1+g6fd5b56-py3.7.egg/xdist/dsession.py", line 272, in worker_collectreport
INTERNALERROR>     self._failed_worker_collectreport(node, rep)
INTERNALERROR>   File "site-packages/pytest_xdist-1.31.1.dev1+g6fd5b56-py3.7.egg/xdist/dsession.py", line 302, in _failed_worker_collectreport
INTERNALERROR>     if rep.longrepr not in self._failed_collection_errors:
INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr'

When run with just one of -n4 and --doctest-modules its fine.

(pytest-debug) :~/PycharmProjects/scratch$ py.test --pyargs test123 -n4
=================================================== test session starts ====================================================
platform linux -- Python 3.7.6, pytest-5.4.1.dev27+g3b48fce, py-1.8.1, pluggy-0.13.0
rootdir: ~/PycharmProjects/scratch
plugins: forked-1.1.3, xdist-1.31.1.dev1+g6fd5b56
gw0 [0] / gw1 [0] / gw2 [0] / gw3 [0]                                                                                      

========================================================== ERRORS ==========================================================
_____________________________________ ERROR collecting test123/test/test_something.py ______________________________________
ImportError while importing test module '~/PycharmProjects/scratch/test123/test/test_something.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test123/test/test_something.py:1: in <module>
    import foo
E   ModuleNotFoundError: No module named 'foo'
================================================= short test summary info ==================================================
ERROR test123/test/test_something.py
=

or

(pytest-debug) :~/PycharmProjects/scratch$ py.test --pyargs test123 --doctest-modules 
=================================================== test session starts ====================================================
platform linux -- Python 3.7.6, pytest-5.4.1.dev27+g3b48fce, py-1.8.1, pluggy-0.13.0
rootdir: ~/PycharmProjects/scratch
plugins: forked-1.1.3, xdist-1.31.1.dev1+g6fd5b56
collected 0 items / 2 errors                                                                                               

========================================================== ERRORS ==========================================================
_____________________________________ ERROR collecting test123/test/test_something.py ______________________________________
test123/test/test_something.py:1: in <module>
    import foo
E   ModuleNotFoundError: No module named 'foo'
_____________________________________ ERROR collecting test123/test/test_something.py ______________________________________
ImportError while importing test module '~/PycharmProjects/scratch/test123/test/test_something.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test123/test/test_something.py:1: in <module>
    import foo
E   ModuleNotFoundError: No module named 'foo'
================================================= short test summary info ==================================================
ERROR test123/test/test_something.py - ModuleNotFoundError: No module named 'foo'
ERROR test123/test/test_something.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================== 2 errors in 0.06s =====================================================

Project is a minimal set of test files

~/PycharmProjects/scratch$ find test123 | grep -v __pycache__
test123
test123/test
test123/test/test_something.py
test123/__init__.py

and versions are

# packages in environment at /..../pytest-debug:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       0_gnu    conda-forge
apipkg                    1.5                      pypi_0    pypi
attrs                     19.3.0                     py_0    conda-forge
ca-certificates           2019.11.28           hecc5488_0    conda-forge
certifi                   2019.11.28       py37hc8dfbb8_1    conda-forge
execnet                   1.7.1                    pypi_0    pypi
importlib-metadata        1.5.2            py37hc8dfbb8_0    conda-forge
importlib_metadata        1.5.2                         0    conda-forge
ld_impl_linux-64          2.34                 h53a641e_0    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.2.0                h24d8f2e_2    conda-forge
libgomp                   9.2.0                h24d8f2e_2    conda-forge
libstdcxx-ng              9.2.0                hdf63c60_2    conda-forge
more-itertools            8.2.0                      py_0    conda-forge
ncurses                   6.1               hf484d3e_1002    conda-forge
openssl                   1.1.1e               h516909a_0    conda-forge
packaging                 20.1                       py_0    conda-forge
pip                       20.0.2                     py_2    conda-forge
pluggy                    0.13.0                   py37_0    conda-forge
py                        1.8.1                      py_0    conda-forge
py-cpuinfo                5.0.0                      py_0    conda-forge
pyparsing                 2.4.6                      py_0    conda-forge
pytest                    5.4.1.dev27+g3b48fce          pypi_0    pypi
pytest-forked             1.1.3                    pypi_0    pypi
pytest-xdist              1.31.1.dev1+g6fd5b56.d20200326          pypi_0    pypi
python                    3.7.6           h8356626_5_cpython    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
readline                  8.0                  hf8c457e_0    conda-forge
ripgrep                   11.0.2               h516909a_3    conda-forge
setuptools                46.1.3           py37hc8dfbb8_0    conda-forge
six                       1.14.0                     py_1    conda-forge
sqlite                    3.30.1               hcee41ef_0    conda-forge
tk                        8.6.10               hed695b0_0    conda-forge
wcwidth                   0.1.8              pyh9f0ad1d_1    conda-forge
wheel                     0.34.2                     py_1    conda-forge
xz                        5.2.4             h516909a_1002    conda-forge
zipp                      3.1.0                      py_0    conda-forge
zlib                      1.2.11            h516909a_1006    conda-forge

@namwooo
Copy link

namwooo commented Mar 27, 2020

I have encountered the same issue. I have found that this is version problem with pytest-5.4.1.
Temporarily, downgrading your pytest-5.4.1 to pytest-5.1.1 would be helpful.

blueyed added a commit to blueyed/pytest that referenced this issue Mar 30, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes pytest-dev#6925.
Fixes pytest-dev/pytest-xdist#515.
blueyed added a commit to blueyed/pytest-xdist that referenced this issue Mar 30, 2020
Reproduces:

    INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr'

Ref: pytest-dev#515
Ref: pytest-dev/pytest#6988
blueyed added a commit to blueyed/pytest-xdist that referenced this issue Mar 30, 2020
Reproduces:

    INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr'

Ref: pytest-dev#515
Ref: pytest-dev/pytest#6988
blueyed added a commit to blueyed/pytest that referenced this issue Mar 31, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes pytest-dev#6925.
Fixes pytest-dev/pytest-xdist#515.
blueyed added a commit to blueyed/pytest that referenced this issue Mar 31, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes pytest-dev#6925.
Fixes pytest-dev/pytest-xdist#515.
blueyed added a commit to blueyed/pytest that referenced this issue Apr 2, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes pytest-dev#6925.
Fixes pytest-dev/pytest-xdist#515.
blueyed added a commit to blueyed/pytest that referenced this issue Apr 2, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes pytest-dev#6925.
Fixes pytest-dev/pytest-xdist#515.
blueyed added a commit to pytest-dev/pytest that referenced this issue Apr 2, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes #6925.
Fixes pytest-dev/pytest-xdist#515.
blueyed added a commit to blueyed/pytest that referenced this issue Apr 2, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes pytest-dev#6925.
Fixes pytest-dev/pytest-xdist#515.

(cherry picked from commit 20f6331)
blueyed added a commit to blueyed/pytest-xdist that referenced this issue Apr 2, 2020
Reproduces:

    INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr'

Ref: pytest-dev#515
Ref: pytest-dev/pytest#6988
blueyed added a commit to blueyed/pytest-xdist that referenced this issue Apr 2, 2020
Reproduces:

    INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr'

Ref: pytest-dev#515
Ref: pytest-dev/pytest#6988
blueyed added a commit to pytest-dev/pytest that referenced this issue Apr 3, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes #6925.
Fixes pytest-dev/pytest-xdist#515.

(cherry picked from commit 20f6331)
webknjaz added a commit to ansible/pylibssh that referenced this issue Apr 29, 2020
@andreabisello
Copy link

andreabisello commented May 13, 2020

I have encountered the same issue , solved upgrading pytest and pytest-xdist to the latest version.

blueyed added a commit to blueyed/pytest that referenced this issue Nov 8, 2020
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes pytest-dev#6925.
Fixes pytest-dev/pytest-xdist#515.

(cherry picked from commit 20f6331)

pytest-dev#6988

Conflicts:
	src/_pytest/_code/code.py
	testing/code/test_code.py
blueyed added a commit to blueyed/pytest-xdist that referenced this issue Dec 11, 2020
Reproduces:

    INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr'

Ref: pytest-dev#515
Ref: pytest-dev/pytest#6988
nicoddemus pushed a commit to blueyed/pytest-xdist that referenced this issue Sep 6, 2022
Reproduces:

    INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr'

Ref: pytest-dev#515
Ref: pytest-dev/pytest#6988
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants