I created some test scripts using selenium python and they have been working okay. However, I have had trouble when I tried to generate an html report or an allure report.
I used the following command to try to generate a pytest html report: "pipenv
run python -m
pytest xxx/test_xxxx.py --html=report.html
". However, I got the following error: "
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --html=report.html
inifile: None
rootdir: C:\Users\xxxx\xxxx"
. I had installed the pytest-html
plugin using pip install pytest-html
, so I am not sure what I have been doing wrong.
I tried uninstalling and reinstalling, but that did not work. I also tried the following links (among others):
- pytest: error: unrecognized arguments: --html=report.html
- generate html and json reports for selenium python automation test using pytest
Does anyone have any insight?
CodePudding user response:
I think I have found the solution. Since I am using pipenv to run my tests, I would have to install the dependencies through pipenv as well. So for the html and allure reports, the full commands would be as follows:
pipenv run pip install allure-pytest
pipenv run pip install pytest-html
After trying this, I ran my previous commands and I no longer got the issue.