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

Add clock event loop as default #110

Conversation

derekbrokeit
Copy link

@derekbrokeit derekbrokeit commented Feb 4, 2019

Extend #96 clock_event_loop fixture to become default event_loop

I am adding this as a separate merge request because I am uncertain if making this behavior default is desirable, so it is here for your consideration. As I mentioned in #96, if this behavior is to be as a separate event-loop, major refactoring to the pytest_fixture_setup and similar methods will be needed since they all assume event_loop is the name of the fixture for event-loops. There is currently no trivial way to allow custom event-loops in pytest-asyncio as far as I can tell. This is the reason #96 fails many of the tests.

…ndard loop

improve documentation of ClockEventLoop
…nt-loop

* remotes/base/master:
  More specific Hypothesis detection
  Support async tests which use Hypothesis
  Move pytest warning config to setup.cfg
  Fix: Avoid warning on latest Pytest versions
- ClockEventLoop is developed in a function to allow for later changes
  to event loop policies
- rework `advance_time` method to better symbolize the needed loop
  iterations. This is marked by a change to a function that returns
  an awaitable.
- uses a custom policy meta class that uses the existing policy to
  modify the new loop it creates.
- The new loop it creates is modified to provide `advance_time`
  coroutine for testing
- Extends pytest-dev#96 to make ClockEventLoop the default policy for testing
@derekbrokeit
Copy link
Author

Looking at this implementation, the same utilities here can actually be refactored out to a clean fixture as suggested in #83 if desired. If desired, the advance_time method used here could be broken out into a fixture to remove the need to change the underlying loop policy and class, which might be a cleaner solution.

derekbrokeit added a commit to derekbrokeit/pytest-asyncio that referenced this pull request Feb 18, 2019
@derekbrokeit
Copy link
Author

Closing this because #113 is a better solution in my opinion

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.

None yet

1 participant