Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

AttributeError: 'NoneType' object has no attribute '_registry' with pytest 5.3.0 #46

Closed
JuleBert opened this issue Nov 21, 2019 · 5 comments

Comments

@JuleBert
Copy link

Hi there,

I run pytest with pytest-parallel (v 0.0.9) in a Gitlab CI-Pipeline.
Without changing my code the pipeline jobs stopped working. The only thing that change was the pytest version from 5.2.4 to 5.3.0.

Also the pipeline job doesn't seem to stop. It's stuck in the status running until I cancel it.

The failed command is:
- python setup.py install && pytest --workers 4
where setup.py install is our project specific setup script.

The hopefully relevant output:

============================= test session starts ==============================
platform linux -- Python 3.7.5, pytest-5.3.0, py-1.8.0, pluggy-0.13.0
rootdir: /builds/fsd/odx-ninja
plugins: parallel-0.0.9
collected 70 items
pytest-parallel: 4 workers (processes), 1 test per worker (thread)
....Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.7/site-packages/pytest_parallel/__init__.py", line 81, in run
    run_test(self.session, item, None)
  File "/usr/local/lib/python3.7/site-packages/pytest_parallel/__init__.py", line 51, in run_test
    item.ihook.pytest_runtest_protocol(item=item, nextitem=nextitem)
  File "/usr/local/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 86, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.7/site-packages/_pytest/runner.py", line 82, in pytest_runtest_protocol
    item.ihook.pytest_runtest_logfinish(nodeid=item.nodeid, location=item.location)
  File "/usr/local/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 92, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 86, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.7/site-packages/_pytest/terminal.py", line 468, in pytest_runtest_logfinish
    main_color, _ = _get_main_color(self.stats)
  File "/usr/local/lib/python3.7/site-packages/_pytest/terminal.py", line 1102, in _get_main_color
    for found_type in stats:
  File "<string>", line 2, in __iter__
  File "/usr/local/lib/python3.7/multiprocessing/managers.py", line 825, in _callmethod
    proxytype = self._manager._registry[token.typeid][-1]
AttributeError: 'NoneType' object has no attribute '_registry'

When the --workers 4 was removed the CI pipeline didn't fail.

To avoid this we now fixed the pytest version to 5.2.4.

I also created an issue at pytest:
pytest-dev/pytest#6254

I hope I could help.

Best regards

@blueyed
Copy link
Contributor

blueyed commented Nov 21, 2019

See #36 (comment).

blueyed added a commit to blueyed/pytest-parallel that referenced this issue Nov 22, 2019
This works around kevlened#46.

It also seems to be good in general, since this also mangles the output
(and appears to be off (far behind in percentage) for when it appears etc).
@blueyed
Copy link
Contributor

blueyed commented Nov 22, 2019

As a workaround pytest -o console_output_style=classic should also work (#50).

kevlened pushed a commit that referenced this issue Nov 22, 2019
This works around #46.

It also seems to be good in general, since this also mangles the output
(and appears to be off (far behind in percentage) for when it appears etc).
@blueyed
Copy link
Contributor

blueyed commented Nov 22, 2019

This is fixed.

@kevlened
There are quite a few more fixed / duplicate issues, would be good if you could go through them.
Happy to help there also, but would require to invite me to the repo.

@kevlened
Copy link
Owner

Thanks @blueyed! I'll go through them this afternoon.

@JuleBert
Copy link
Author

Hi there,
with pytest-parallel version 0.0.10 it now works.

Thanks a lot!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants