Skip to content

Commit 2c37501

Browse files
authored
tests: Avoid DeprecationWarning when settings up uvloop (#1382)
`EventLoopPolicy` is going away, so just call `uvloop.new_event_loop()` directly.
1 parent b7eea79 commit 2c37501

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎asyncpg/_testbase/__init__.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ class TestCase(unittest.TestCase, metaclass=TestCaseMeta):
101101
def setUpClass(cls):
102102
if os.environ.get('USE_UVLOOP'):
103103
import uvloop
104-
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
104+
loop = uvloop.new_event_loop()
105+
else:
106+
loop = asyncio.new_event_loop()
105107

106-
loop = asyncio.new_event_loop()
107108
asyncio.set_event_loop(None)
108109
cls.loop = loop
109110

0 commit comments

Comments
 (0)