You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The top one reports ERROR at teardown of test_mocksocket_mocker. The bottom one does not report any error. The only difference between them is that the bottom one requests the event_loop fixture.
The error message is quite long. It seems to be caused by MockSocket still being active when _provide_clean_event_loop() is called, and the new event loop failing at initialization.
Also, if the test case calls unittest.mock.patch instead of mocker.patch, then there is no error.
Attached is the test file, full console output, and package versions. This is running on Windows 10.
This avoids conflict between the event loop and mocker fixtures. Without this fix, the event loop fixture tries to create a new event loop with a modified socket class, causing failure.
pytest-dev/pytest-asyncio#818
This also completes "How to migrate from pytest-asyncio v0.21" in pytest-asyncio's docs.
Consider the two test cases below:
The top one reports
ERROR at teardown of test_mocksocket_mocker
. The bottom one does not report any error. The only difference between them is that the bottom one requests theevent_loop
fixture.The error message is quite long. It seems to be caused by MockSocket still being active when
_provide_clean_event_loop()
is called, and the new event loop failing at initialization.Also, if the test case calls
unittest.mock.patch
instead ofmocker.patch
, then there is no error.Attached is the test file, full console output, and package versions. This is running on Windows 10.
pytest-asyncio-mock.zip
The text was updated successfully, but these errors were encountered: