numirias / pytest-json-report

🗒️ A pytest plugin to report test results as JSON
MIT License
146 stars 39 forks source link

AttributeError: 'TestReport' object has no attribute '_json_report_extra' #51

Closed renlon closed 4 years ago

renlon commented 4 years ago

Encounter the following error when run pytest with pytest-xdist + pytest-json-report

Maybe this is more like a feature request. Or there is another way to run the test in xdist mode (multiple process in parallel) and get round this issue.

Here are the command options: Pytest command options: ['--json-report', '--json-report-file=./test-report.json', '-s', 'test-integ/', '-n', '8', '--dist=loadfile', '--max-slave-restart=0']

Here is the error:

INTERNALERROR>   File "/lib/python3.7/site-packages/pytest_jsonreport/plugin.py", line 169, in pytest_runtest_logreport
INTERNALERROR>     metadata = report._json_report_extra.get('metadata')
INTERNALERROR> AttributeError: 'TestReport' object has no attribute '_json_report_extra'

Ptest-xdist 1.2.1 Python: 3.7 Pytest: 5.x Pytest-json-report: latest

renlon commented 4 years ago

The issue only happen with pytest xdist 1.20 the issue resolved itself after upgrading xdist to 1.31

Silipwn commented 3 years ago

How to debug this?

Having similar configuration with

Python 3.7.9
pytest 6.2.2
pytest-xdist 2.1.1
pytest-json-report 1.2.4
numirias commented 3 years ago

@Silipwn Any chance you could give a reproducible example? Then I'm happy to take a look.

Silipwn commented 3 years ago

It actually worked out on a fresh install, I guess probably some cached package was causing the issue.