Repository navigation
Fix --generate-missing reporting defined background steps as missing - #843
Open
taltal-beep wants to merge 3 commits into
Open
taltal-beep wants to merge 3 commits into
taltal-beep wants to merge 3 commits into
Conversation
parse_feature_files() listed each background Step object once per scenario. Binding a scenario removed only one copy, and steps of unbound scenarios are dropped only if they are not background steps, so a defined background step was reported (and a stub generated for it) as soon as the feature had an unbound scenario. Keep each step object once.
…g-shared-background
…g-shared-background
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
parse_feature_files()collectsscenario.stepsfor every scenario, and those include the feature's (and rule's) background steps, so each backgroundStepobject is listed once per scenario.Stepuseseq=False, so_show_missing_code_mainremoves only one copy when a bound test defines it, and steps of unbound scenarios are skipped if they belong to a background. So as soon as a feature with a background has an unbound scenario, a background step that is defined gets reported as "Background step … is not defined", a stub is generated for it, and the exit code is 100.Repro:
with
I have a foobarandI have a bardefined and only "Bound scenario" bound:pytest --generate-missing --feature generation.featureprints an@given('I have a foobar')stub.This keeps each step object only once (
dict.fromkeys, identity-based because ofeq=False) and adds a regression test with one bound and one unbound scenario. The test fails onmasterand passes with the change. Full suite passes (147), pre-commit (ruff check/format) and mypy are clean. Changelog entry added under Unreleased / Fixed.