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 hook reference - pytest_cmdline_preparse deprecated #3022

Closed
buddhadev opened this issue Dec 12, 2017 · 6 comments
Closed

pytest hook reference - pytest_cmdline_preparse deprecated #3022

buddhadev opened this issue Dec 12, 2017 · 6 comments
Labels
type: docs documentation improvement, missing or needing clarification

Comments

@buddhadev
Copy link

pytest documentation mentions that pytest_cmdline_preparse hook will be deprecated.

Reference:

https://docs.pytest.org/en/latest/writing_plugins.html#_pytest.hookspec.pytest_cmdline_preparse

Question

What is the alternative to this hook moving forward?

@pytestbot pytestbot added the type: docs documentation improvement, missing or needing clarification label Dec 12, 2017
@pytestbot
Copy link
Contributor

GitMate.io thinks the contributor most likely able to help you is @nicoddemus.

@nicoddemus
Copy link
Member

I don't know so I dug around a little, it seems that deprecation was introduced in db6f347 with the introduction of pytest_load_initial_conftests, so I would recommend using that instead.

@buddhadev
Copy link
Author

Thanks @nicoddemus !

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Dec 12, 2017
Also mention which hook to use instead of the deprecated
pytest_cmdline_preparse

Fix pytest-dev#3022
@Sup3rGeo
Copy link
Member

@nicoddemus the documentation uses pytest_cmdline_preparse in one example:

https://docs.pytest.org/en/latest/example/simple.html#dynamically-adding-command-line-options

Should it be updated to use pytest_load_initial_conftests ?

@nicoddemus
Copy link
Member

Definitely @Sup3rGeo, thanks for noticing. Opened #3417 for it.

@Apteryks
Copy link

Apteryks commented Sep 30, 2021

Unfortunately pytest_load_initial_conftests doesn't work from inside conftest.py, so it's not an exact replacement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs documentation improvement, missing or needing clarification
Projects
None yet
Development

No branches or pull requests

5 participants