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-cases not compatible with pytest-repeat #269
Comments
Thanks @PiQuer for spotting this ! Could you please let me know the version of pytest-cases you are using ? Indeed the latest version of pytest-cases should have fixed this specific line popping in the stack trace. Thanks in advance ! |
I can reproduce the error with pytest 3.6.11 and with the latest master def94ce. |
super, thanks for the confirmation ! I therefore have to investigate in order to understand why there is some fixture reordering when pytest-repeat is enabled. It seems strange that simply repeating tests would trigger re-ordering, but I do not know what they actually do... |
Thanks for investigating! I guess it is practically impossible to be compatible with all pytests plugins out there, if they have a certain complexity. I just thought it would be good to document the incompatibility. Pytest-repeat looked like a good fit to easily get statistics about unstable tests, but for me it is not top-priority to get this working ;) |
It seems that they define a I'll see what I can do |
Well I do not clearly understand why this happens in the first place (even without pytest-cases).. I tried to run the following simple example : import pytest
@pytest.mark.parametrize("arg", (1,))
def test_repeat(arg):
assert True And then put a breakpoint in Inspecting the variables: >>> self.names_closure
['environment', 'arg', '__pytest_repeat_step_number']
>>> closure
{'arg', 'environment'} So the function seems to try to remove the fixture that was added by pytest-repeat (!). That's where I raise the error, as in pytest cases, One workaround could be to simply accept removal of fixtures in the tree, without reordering (I currently simply ignore reordering and create a warning message). In this particular situation, this would be enough to make the plugin compatibility work. |
…test-repeat`, by support removal from fixture closure tree. Fixed #269
…ity with other plugins (#273) * Initial test to reproduce the bug. * Improved compatibility with other `pytest` plugins, in particular `pytest-repeat`, by support removal from fixture closure tree. Fixed #269 * Improved readability of fix for future maintenance. Fixed test. Co-authored-by: Sylvain MARIE <sylvain.marie@se.com>
It should be fixed in 3.6.12, available in a few minutes. Let me know if this works for you ! |
Looks good! Thanks for the fix :) |
Thanks again @PiQuer for the contribution |
Pytest-repeat is a plugin for, well, repeating tests :)
Tested with pytest-cases 3.6.11 and pytest-repeat 0.9.1, python version 3.9.9:
A minimal example to reproduce the issue is this test_repeat.py:
When run with
pytest test_repeat.py
it works, but withpytest test_repeat.py --count=10
it raises the following exception:Note that repeat works when the case function itself is not parametrized.
The text was updated successfully, but these errors were encountered: