Comments (4)
@youtux You were right! It was pytest-bdd-html
after all! I will raise in their repo.
Thanks a lot for your effort.
from pytest-bdd.
As mentioned in #679 (comment), pytest-bdd works fine with pytest-xdist and it's tested against it.
I even tried reproducing the issue installing py3.7, pytest==7.4.3, pytest-bdd==6.1.1, pytest-xdist==3.5.0, but I don't see any error.
If it doesn't work for you, please first try to upgrade your dependencies (as you seem to be using outdated versions of pytest-bdd, pytest and pytest-xdist).
If it still doesn't work, please provide a MCVE so that I can debug the issue.
Closing this unless more info is provided.
from pytest-bdd.
Thanks for your reply. @youtux
Posted the issue on pytest-xdist
git, and the devs there said the issue lies with pytest-bdd
:
pytest-dev/pytest-xdist#1038
I can reproduce the issue on my demo project, https://github.com/AmirYa412/Pytest-BDD-Project
Note: Need to replace in requirements.txt file from pytest-parallel
to pytest-xdist==3.5.0
.
Simply installed dependencies on a venv, and ran pytest -n 2
command reproduced the issue for me on MacOS Sonoma.
Dependencies:
pytest==7.4.3
pytest-bdd==6.1.1
pytest-bdd-html==0.1.14a0
pytest-html==3.2.0
pytest-metadata==3.0.0
pytest-xdist==3.5.0
requests==2.31.0
urllib3==1.26.12
Sadly in my company, we are running on Python 3.7 for now, so upgrading to latest pytest-bdd
version is currently impossible. I will try running my project with 3.11 and update in new comment.
Here is the full error log:
========================================================================================================= test session starts ==========================================================================================================
platform darwin -- Python 3.7.3, pytest-7.4.3, pluggy-1.2.0
rootdir: /Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project
configfile: pytest.ini
testpaths: steps
plugins: html-3.2.0, metadata-3.0.0, xdist-3.5.0, bdd-html-0.1.14a0, bdd-6.1.1
2 workers [10 items]
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 "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1498, in _save
INTERNALERROR> E dispatch = self._dispatch[tp]
INTERNALERROR> E KeyError: <class 'pytest_bdd.parser.Step'>
INTERNALERROR> E
INTERNALERROR> E During handling of the above exception, another exception occurred:
INTERNALERROR> E
INTERNALERROR> E Traceback (most recent call last):
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR> E session.exitstatus = doit(config, session) or 0
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/_pytest/main.py", line 325, in _main
INTERNALERROR> E config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_hooks.py", line 433, in __call__
INTERNALERROR> E return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_manager.py", line 112, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_callers.py", line 155, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_result.py", line 108, in get_result
INTERNALERROR> E raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_callers.py", line 80, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/xdist/remote.py", line 157, in pytest_runtestloop
INTERNALERROR> E self.run_one_test()
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/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 "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_hooks.py", line 433, in __call__
INTERNALERROR> E return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_manager.py", line 112, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_callers.py", line 155, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_result.py", line 108, in get_result
INTERNALERROR> E raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_callers.py", line 80, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/_pytest/runner.py", line 114, in pytest_runtest_protocol
INTERNALERROR> E runtestprotocol(item, nextitem=nextitem)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/_pytest/runner.py", line 133, in runtestprotocol
INTERNALERROR> E reports.append(call_and_report(item, "call", log))
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/_pytest/runner.py", line 226, in call_and_report
INTERNALERROR> E hook.pytest_runtest_logreport(report=report)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_hooks.py", line 433, in __call__
INTERNALERROR> E return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_manager.py", line 112, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_callers.py", line 116, in _multicall
INTERNALERROR> E raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_callers.py", line 80, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/xdist/remote.py", line 227, in pytest_runtest_logreport
INTERNALERROR> E self.sendevent("testreport", data=data)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/xdist/remote.py", line 87, in sendevent
INTERNALERROR> E self.channel.send((name, kwargs))
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 811, in send
INTERNALERROR> E self.gateway._send(Message.CHANNEL_DATA, self.id, dumps_internal(item))
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1469, in dumps_internal
INTERNALERROR> E return _Serializer().save(obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1487, in save
INTERNALERROR> E self._save(obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1505, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1580, in save_tuple
INTERNALERROR> E self._save(item)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1505, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1576, in save_dict
INTERNALERROR> E self._write_setitem(key, value)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1570, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1505, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1576, in save_dict
INTERNALERROR> E self._write_setitem(key, value)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1570, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1505, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1566, in save_list
INTERNALERROR> E self._write_setitem(i, item)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1570, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1505, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1580, in save_tuple
INTERNALERROR> E self._save(item)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1505, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1576, in save_dict
INTERNALERROR> E self._write_setitem(key, value)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1570, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1505, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1566, in save_list
INTERNALERROR> E self._write_setitem(i, item)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1570, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/execnet/gateway_base.py", line 1503, in _save
INTERNALERROR> E raise DumpError(f"can't serialize {tp}")
INTERNALERROR> E execnet.gateway_base.DumpError: can't serialize <class 'pytest_bdd.parser.Step'>
INTERNALERROR> E assert False
INTERNALERROR>
INTERNALERROR> venv-bdd/lib/python3.7/site-packages/xdist/dsession.py:200: AssertionError
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/_pytest/main.py", line 325, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_hooks.py", line 433, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_manager.py", line 112, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_callers.py", line 155, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_result.py", line 108, in get_result
INTERNALERROR> raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/pluggy/_callers.py", line 80, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/xdist/dsession.py", line 123, in pytest_runtestloop
INTERNALERROR> self.loop_once()
INTERNALERROR> File "/Users/aaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/xdist/dsession.py", line 148, in loop_once
INTERNALERROR> call(**kwargs)
INTERNALERROR> File "/Users/aaaaaa/Desktop/Projects/personal_projects/Pytest-BDD-Project/venv-bdd/lib/python3.7/site-packages/xdist/dsession.py", line 187, in worker_workerfinished
INTERNALERROR> assert not crashitem, (crashitem, node)
INTERNALERROR> AssertionError: ('steps/comments_steps/test_comments.py::test_publish_new_comment_on_random_post[Foo [email protected] t3xt w!th sp3ci@l ch@r@cters]', <WorkerController gw1>)
INTERNALERROR> assert not 'steps/comments_steps/test_comments.py::test_publish_new_comment_on_random_post[Foo [email protected] t3xt w!th sp3ci@l ch@r@cters]'
from pytest-bdd.
Try removing the pytest-bdd-html dependency, that's the one causing the error.
from pytest-bdd.
Related Issues (20)
- `iterparentnodeids` removed from pytest HOT 1
- Step definition parses wrong parameter from feature file
- Unable to run parallel tests with pytest-xdist - can't serialize <class 'pytest_bdd.parser.Step'> HOT 1
- Pytest emits deprecation warning: "A private pytest class or function was used" HOT 3
- pytest-bdd doesn't support pytest 8.1.0 HOT 5
- Missing git tags for 7.1 and 7.1.1 releases HOT 1
- Python 3.8/pytest 3.0.4/pytest-bdd 3.1.0 crash: TypeError: an integer is required (got type bytes) HOT 2
- Pytest 8.1.1 fixture injection compability HOT 2
- Does pytest-bdd support pytest-xdist? HOT 2
- Version 7.1.2 no longer provides pytest_bdd.steps.inject_fixture HOT 1
- Issue with existing working automation after python 3.11.1 and pytest-bdd 7.00 upgrade HOT 6
- Re-use of target_fixture not possible anymore HOT 2
- How to apply for function/module/package/session scope to feature HOT 2
- Is there a hook for 'before_feature' in pytest-bdd? HOT 2
- Multiple step scenarios targeting the same fixture doesn't update the fixture HOT 8
- Stacking multiple `then` decorators breaks parametrization HOT 2
- Document data tables
- multiple test files are triggered by single feature file HOT 3
- Custom fixture unable to inherit target_fixtures HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-bdd.