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

--hypothesis-show-statistics doesn't work with pytest-xdist #700

Closed
DRMacIver opened this issue Jun 20, 2017 · 1 comment
Closed

--hypothesis-show-statistics doesn't work with pytest-xdist #700

DRMacIver opened this issue Jun 20, 2017 · 1 comment
Assignees
Labels
bug something is clearly wrong here

Comments

@DRMacIver
Copy link
Member

DRMacIver commented Jun 20, 2017

If you use the flag while running with xdist then you'll get no statistics. This is presumably because the tests are running in a different process than the collector, so the data isn't getting communicated back.

To reproduce e.g. run pytest --hypothesis-show-statistics tests/cover/test_testdecorators.py, which will use the default Hypothesis configuration and run with two child runners and show no statistics.

@DRMacIver DRMacIver added the bug something is clearly wrong here label Jun 20, 2017
@Zac-HD
Copy link
Member

Zac-HD commented Aug 1, 2018

Related to pytest-dev/pytest-xdist#79. Our current code, which doesn't work with xdist, is:

def pytest_runtest_makereport(item, call):
report = (yield).get_result()
if hasattr(item, 'hypothesis_report_information'):
report.sections.append((
'Hypothesis',
'\n'.join(item.hypothesis_report_information)
))

It looks like we'll need to write some special-case logic to pass the report string back to the master instance when running under xdist, and probably also to receive the data. See e.g. the hook docs and xdist/workermanage.py as starting points.


Update: the reporting quoted above works just fine; it was relying on the global gathered_statistics dict that broke our reporting under xdist. PR incoming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is clearly wrong here
Projects
None yet
Development

No branches or pull requests

2 participants