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

Async steps #609

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Async steps #609

wants to merge 2 commits into from

Conversation

maafy6
Copy link

@maafy6 maafy6 commented Apr 15, 2023

Another start at #223. It seems as though some of the previous cracks at it have stalled, and with there being some significant changes to the baseline overall since those were opened (notably implementing steps as fixtures), I don't think those look too salvageable in their current form. This provides wrappers for step functions when declared as async, the wrapping logic is pretty closely based on what pytest-asyncio does for their @async_fixture (but this does not add pytest-asyncio as a requirement).

Things that might want to be considered:

  • Strict mode - if is_async is set, then raise an error if the function is not async.
  • Optional interop with other plugins (e.g. pytest-asyncio, could just request the event_loop fixture if enabled/available).

This test was failing when run as part of the entire test suite and
passing when run on its own. When the first part of the  expected[0].id
path was changed from test_step_trace0 to test_step_trace1, the results
reversed - it passed as part of the entire suite and failed on its own.
This behavior was not observed prior to the async changed.

I suspect that this is caused by the addition of
test_async_steps.py::test_step_trace, which caused this to no longer
be the first test with the name `test_step_trace` to run as part of the
entire suite. Since there are several other tests with the same name,
it seems like the best course here would be to ensure that this test
has a unique name so that it is more resilient to ordering.
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.

1 participant