freezegun
freezegun copied to clipboard
tests: asyncio: Fix Python 3.10 compatibility
Since Python 3.10, the asyncio.get_event_loop()
has been deprecated in favor of asyncio.get_running_loop()
. That one, however, issues a warning when there's no event loop running (such as in this test suite).
Fix this by always requesting a new event loop. These methods have been available since at least Python 3.5 (and there are no older docs online at this point).
Bug: https://github.com/spulec/freezegun/issues/398