Fix pytest.mark.usefixtures() without arguments silently erroring#13008
Conversation
- Updated _getusefixturesnames to iterate with node and marker using node.iter_markers_with_node. - Modified warning message to include the location of the marker node. - Replaced warnings.warn with node.warn to issue warnings.
fixed typo
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
…without-args-warning
nicoddemus
left a comment
There was a problem hiding this comment.
Thanks @daara-s for picking this up, and also thanks to @JiajunXu2 for the initial PR. 👍
Currently failing due to pytest-bdd
|
Hmm this is breaking the Seems like # We need to tell pytest that the original function requires its fixtures,
# otherwise indirect fixtures would not work.
@pytest.mark.usefixtures(*func_args)Perhaps we might need to update @The-Compiler what do you think? EDIT: in 1b6b836 I ignored the warning to get the tests to pass. |
|
Oh, that's unfortunate... Like you say I suppose pytest-bdd could do the decorating manually and conditionally, in the same way as just below the linked code snippet: example_parametrizations = collect_example_parametrizations(templated_scenario)
if example_parametrizations is not None:
# Parametrize the scenario outlines
scenario_wrapper = pytest.mark.parametrize(
"_pytest_bdd_example",
example_parametrizations,
)(scenario_wrapper) |
This reverts commit f8a8666. Fix merged into pytest-bdd
…without-args-warning
|
Got ahead of myself with the revert. Still need to bump the plugin pin. @youtux what's the release cadence for pytest-bdd? |
|
We don't really have a schedule, just whenever we think it's needed. |
Currently failing due to pytest-bdd
|
Thanks @daara-s and @JiajunXu2 for the work here! 👍 |
|
Sorry for stepping away from the pr, I've been a bit busy lately. Thank you @daara-s for finishing it, and everyone for the support! |
Follow up to #12439.
Closes #12426
Closes #12439