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

Allow "yield" in step definitions #503

Merged
merged 6 commits into from
Feb 24, 2022
Merged

Allow "yield" in step definitions #503

merged 6 commits into from
Feb 24, 2022

Conversation

youtux
Copy link
Contributor

@youtux youtux commented Feb 22, 2022

This way step definitions can define code to be executed during teardown of the test item.
Apparently this behaviour was broken by the 4.0 release.

Fixes #392.

@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #503 (512fd0f) into master (385e6c9) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #503      +/-   ##
==========================================
+ Coverage   95.48%   95.49%   +0.01%     
==========================================
  Files          48       48              
  Lines        1571     1577       +6     
  Branches      170      170              
==========================================
+ Hits         1500     1506       +6     
  Misses         44       44              
  Partials       27       27              
Impacted Files Coverage Δ
pytest_bdd/cucumber_json.py 93.33% <100.00%> (ø)
pytest_bdd/scenario.py 91.07% <100.00%> (ø)
tests/feature/test_steps.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 385e6c9...512fd0f. Read the comment docs.

@youtux youtux merged commit d4f74d2 into master Feb 24, 2022
@youtux youtux deleted the step-def-yield branch February 24, 2022 12:10
@when("I setup stuff", target_fixture="stuff")
def stuff():
print("Setting up...")
yield 42

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yield is not supporting in given

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@given with target_fixture does not behave like pytest-fixture on yield anymore
2 participants