pytest: I am getting error "pytest: error: unrecognized arguments: --show-capture=no" while executing tests using pytest

Command i am trying to execute: pytest --show-capture=no -v --dsn="emulator-5554" -m bat --reruns=2

LINE NUMBERS 
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --show-capture=no
  inifile: /home/ANT.AMAZON.COM/jaiadi/kats-agent/workdir/54/workspace/test/pytest.ini
  rootdir: /home/ANT.AMAZON.COM/jaiadi/kats-agent/workdir/54/workspace/test
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --show-capture=no
  inifile: /home/ANT.AMAZON.COM/jaiadi/kats-agent/workdir/54/workspace/test/pytest.ini
  rootdir: /home/ANT.AMAZON.COM/jaiadi/kats-agent/workdir/54/workspace/test
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --show-capture=no
  inifile: /home/ANT.AMAZON.COM/jaiadi/kats-agent/workdir/54/workspace/test/pytest.ini
  rootdir: /home/ANT.AMAZON.COM/jaiadi/kats-agent/workdir/54/workspace/test

Pytest version i am using:

This is pytest version 5.3.5, imported from /home/ANT.AMAZON.COM/jaiadi/kats-ag...-packages/pytest/__init__.py
setuptools registered plugins:
pytest-rerunfailures-8.0 at /home/ANT.AMAZON.COM/jaiadi/kats-ag...ages/pytest_rerunfailures.py
pytest-cov-2.3.1 at /home/ANT.AMAZON.COM/jaiadi/kats-ag...ackages/pytest_cov/plugin.py

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Most upvoted comments

I think I get why this error happens. Since option is defined in tests/conftest.py it exists inside tests. Whenever I run pytest outside tests I get unrecognized argument error.

in my case I was just missing the package

pip install pytest-asyncio==0.20.1

Please update the rerunfailures plugin as well, and please start to use the code formatting feature of github, it’s painful to read unformatted pastes