You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
this is tricky, I'm leaning on pytest_cmdline_preparse to inject the bazel test target as a suffix to the --log-file.
When I make that modification in pytest_cmdline_preparse the value is reflected before the log is opened and I see the correct value reflected in the pytest_report_header I added to report the --log-file value #13635 (comment).
When I pivot the implementation over to using pytest_load_initial_conftests the ordering must be off or something because the --log-file value still assumes the value passed at the command line shell for the pytest invocation with the suffixing not taking effect.
Activity
pytestbot commentedon Dec 12, 2017
GitMate.io thinks the contributor most likely able to help you is @nicoddemus.
nicoddemus commentedon Dec 12, 2017
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 commentedon Dec 12, 2017
Thanks @nicoddemus !
Add param annotations and types to hookspec
Sup3rGeo commentedon Apr 19, 2018
@nicoddemus the documentation uses
pytest_cmdline_preparsein 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 commentedon Apr 20, 2018
Definitely @Sup3rGeo, thanks for noticing. Opened #3417 for it.
apteryks commentedon Sep 30, 2021
Unfortunately
pytest_load_initial_conftestsdoesn't work from insideconftest.py, so it's not an exact replacement.jxramos commentedon Aug 11, 2025
this is tricky, I'm leaning on
pytest_cmdline_preparseto inject the bazel test target as a suffix to the--log-file.When I make that modification in
pytest_cmdline_preparsethe value is reflected before the log is opened and I see the correct value reflected in thepytest_report_headerI added to report the--log-filevalue #13635 (comment).When I pivot the implementation over to using
pytest_load_initial_confteststhe ordering must be off or something because the--log-filevalue still assumes the value passed at the command line shell for the pytest invocation with the suffixing not taking effect.jxramos commentedon Aug 15, 2025
noting for posterity, the actual deletion of the
pytest_cmdline_preparsehook is found in this commitf4e7b0d#diff-3bcca5362f4ed2c327bb6e465f6f53d516b8bc5561d3ae72a1519666700511a3
This commit landed on Jan 2, 2024, and was released in pytest version 8.1.0
nicoddemus commentedon Aug 16, 2025
@jxramos thanks.
It was deprecated in
7.0.0rc1, but we did not add the respective changelog entry about its removal in8.1.0.Would you like to contribute a PR amending the changelog?
jxramos commentedon Jan 18, 2026
@nicoddemus , ok finally getting back to this, got a PR out on the topic found here #14124.