numirias / pytest-json-report

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

No module named 'pytest_jsonreport' #35

Closed Raglar closed 5 years ago

Raglar commented 5 years ago

Hello! First of all thank you for this great lib.

The issue is the following error: from pytest_jsonreport.plugin import JSONReport ModuleNotFoundError: No module named 'pytest_jsonreport'

when using the following snippet: import pytest from pytest_jsonreport.plugin import JSONReport plugin = JSONReport() pytest.main(['test_foo.py'], plugins=[plugin])

however, using $ pytest --json-report --json-report-summary works fine

I'm using miniconda with a virtual env in Windows, using where pip command points to the correct pip executable with the correct virtual env name.

versions: Python 3.7.3 pytest-json-report-1.0.3 pip 19.0.3 pytest 4.3.1 (displaying that this lib is a registered plugin)

thanks in advanced

numirias commented 5 years ago

Thanks for reporting! This lookup error is most likely not related to the plugin. Unfortunately I'm not familiar with Anaconda setups on Windows, so I can't give you a lot of useful advice on how to fix it.

Maybe running the failing script with python -v ... gives you a hint where Python is looking up the imports. Also, maybe using python -m pytest instead of pytest picks up the right pytest installation.

If you have reason to think this is a bug in this library, feel free to reopen the issue.