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

pytest: error: unrecognized arguments: --doctest-module #5554

Closed
4 tasks done
charlax opened this issue Jul 4, 2019 · 2 comments
Closed
4 tasks done

pytest: error: unrecognized arguments: --doctest-module #5554

charlax opened this issue Jul 4, 2019 · 2 comments

Comments

@charlax
Copy link

charlax commented Jul 4, 2019

  • a detailed description of the bug or suggestion
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Using:

  • pytest version 5.0.0...
  • setuptools registered plugins:
    • doubles-1.5.3
    • pytest-factoryboy-2.0.3
    • pytest-cov-2.7.1
    • pytest-osxnotify-0.1.7
    • pytest-flask-0.15.0

Since v5.0.0, I'm getting unrecognized arguments: --doctest-module.

% pytest
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --doctest-module
  inifile: .../api/setup.cfg
  rootdir: .../api

pytest section of my setup.cfg:

[tool:pytest]
addopts = --tb=native --no-cov-on-fail --doctest-module --ignore=migrations/env.py --ignore=migrations/
filterwarnings =
    ignore::DeprecationWarning

The v5 changelog does mention something about --doctest-module but it does not offer any explanation why my case would fail... Also, I'm still following the setup recommended in https://docs.pytest.org/en/latest/doctest.html

@nicoddemus
Copy link
Member

nicoddemus commented Jul 4, 2019

Hi @charlax,

The option is named --doctest-modules (plural). This used to work prior 5.0 because ArgumentParser contains a feature that accepts "partial options", that's why --doctest-module used to work. We have disabled "partial options" because it brings a number of problems.

This is mentioned in more details on the CHANGELOG:

#1149: Pytest no longer accepts prefixes of command-line arguments, for example typing pytest --doctest-mod inplace of --doctest-modules. This was previously allowed where the ArgumentParser thought it was unambiguous, but this could be incorrect due to delayed parsing of options for plugins. See for example issues #1149, #3413, and #4009.

I'm closing for now, feel free to follow up with other questions. 👍

@charlax
Copy link
Author

charlax commented Jul 4, 2019

🤦‍♂

Oh nice catch! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants