-
Notifications
You must be signed in to change notification settings - Fork 6
pytest-harvest + pytest-steps: results_bag fixture is cross-step, how to get per-step? #49
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
Comments
Thanks @j-carson ! This is a very nice way indeed to fix this issue. However if Therefore, I would suggest the following, I suspect that it works too: @pytest.fixture
@one_fixture_per_step
def step_bag(results_bag):
return results_bag Do you confirm ? More generally I think that your proposal could make a great addition to |
The shorter implementation of
I will need to write a test case to verify this second question. |
Wrote the test case for above: In a virtualenv with pytest-steps installed but not pytest-harvest, the above fixture will not cause an error if that fixture is not used by any test. |
Cool ! Then it seems that all lights are green :) The fixture would need to live in module
(No need to test the case when the pytest-harvest plugin is not installed, this is a pytest mechanism and it wont change over time). let me know ! |
Fixed by #46 |
I have just started using your pytest extensions - they are wonderful, thank you!
I had a pytest-steps test with four steps, and each step saved the current value of a variable at the end of each step. The results_bag only had the value of the variable at the last step, and that value appeared in the row for the first step.
I fixed it by creating a per-step results bag fixture and using that in place of results_bag as the argument to my test. Is this the best way to get my desired behavior?
The text was updated successfully, but these errors were encountered: