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

Bug: Parser Arguments being overwritten #607

Open
samuelspagl opened this issue Apr 4, 2023 · 0 comments
Open

Bug: Parser Arguments being overwritten #607

samuelspagl opened this issue Apr 4, 2023 · 0 comments

Comments

@samuelspagl
Copy link

Hey there,

first of all thanks a lot for this amazing project, I really love working with it. :)

Describe the situation

I'm trying to reuse my fixtures / step definitions as often as possible to make my test code concise and clean. That's why I rely a lot on the feature of using multiple BDD decorators for one function.
In one situation, which is for my case not really uncommon, I want to use a function like this:

@given("Do some stuff", target_fixture="stuff")
@when(parsers.parse("you did a \"{action_type}\"", target_fixture="stuff")
def do_some_stuff(action_type: str = None):
   ...

The argument (action_type) for the second decorator (when) will never be correctly filled, but always uses the fallback value None

Expected Behaviour

The BDD argument should be correctly inserted as an argument for the function, and the "fallback" value of the function should only be used if there's no input for this argument.

Test system:

💻: MacOS Ventura
🐍: 3.10
Pytest Version: 7.2.2
Pytest_BDD Version: 6.1.1

I also tested it with a fresh install of pytest and pytest_bdd

Thanks a lot in advance

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

No branches or pull requests

1 participant