Skip to content

How to manage two "then" whose order is unknown ? #636

Closed Answered by youtux
jp-pacotte asked this question in Q&A
Discussion options

You must be logged in to vote

pytest-bdd doesn't support that, you will have to come up with something that collects logs and that then checks the collected logs. Here is a suggestion of how the feature could look like:

Feature: Foo
   dectection of 2 events not ordered

   Scenario: event A and event B detected
     Given the system is ready
     And I am collecting logs
     
     When i do action

     Then event A detected
     And event B detected

and the "I collect logs" could be defined as

@pytest.fixture
def collected_logs():
    return []

@then("I collect logs")
def _(shh_interraction, collected_logs, request):
    shh_interraction.tail(callback=lambda log: collected_logs.append(log))
    # make sure to stop…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by youtux
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants