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 (or test that) step functions can have the same name #525

Closed
youtux opened this issue Jul 4, 2022 · 0 comments · Fixed by #534
Closed

Allow (or test that) step functions can have the same name #525

youtux opened this issue Jul 4, 2022 · 0 comments · Fixed by #534
Assignees
Milestone

Comments

@youtux
Copy link
Contributor

youtux commented Jul 4, 2022

We should allow (or make sure we test that) step functions can have the same name even within the same module and that multiple step decorators can be applied and work as expected.
This will allow all steps to be called _ (inspired by ward), since most of the context is given by the name= parameter passed to the step definition.

For example, this should be allowed, documented and tested.

@given(parsers.parse("there is a foo with value {value:d}"), target_fixture="foo")
@given(parsers.parse("there is a second with value {value}"), target_fixture="second_foo", converters={"value": int})
def _(value: int) -> Foo:
    return Foo(value=value)


@given("there is a bar", target_fixture="bar")
@given("there is a second bar", target_fixture="second_bar")
def _() -> Bar:
    return Bar()


@when("I click the foo")
def _(foo) -> None:
    return foo.click()


@when("I click the bar")
def _(bar) -> None:
    return bar.click()
...

Possibly replacing all the usages in the README.rst too.

@youtux youtux added this to the v7 milestone Jul 4, 2022
@youtux youtux self-assigned this Jul 4, 2022
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 a pull request may close this issue.

1 participant