Skip to content

Commit a50d815

Browse files
committed
modified run for thread
1 parent 59d4f3e commit a50d815

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

test/asynchronous/test_auth.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""Authentication Tests."""
1616
from __future__ import annotations
1717

18+
import asyncio
1819
import os
1920
import sys
2021
import threading
@@ -75,9 +76,12 @@ def __init__(self, collection):
7576
self.collection = collection
7677
self.success = False
7778

78-
async def run(self):
79-
assert await self.collection.find_one({"$where": delay(1)}) is not None
80-
self.success = True
79+
def run(self):
80+
async def _run_async(self):
81+
assert await self.collection.find_one({"$where": delay(1)}) is not None
82+
self.success = True
83+
84+
asyncio.run(self.run_async())
8185

8286

8387
class TestGSSAPI(unittest.IsolatedAsyncioTestCase):

test/test_auth.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""Authentication Tests."""
1616
from __future__ import annotations
1717

18+
import asyncio
1819
import os
1920
import sys
2021
import threading
@@ -76,8 +77,11 @@ def __init__(self, collection):
7677
self.success = False
7778

7879
def run(self):
79-
assert self.collection.find_one({"$where": delay(1)}) is not None
80-
self.success = True
80+
def _run_async(self):
81+
assert self.collection.find_one({"$where": delay(1)}) is not None
82+
self.success = True
83+
84+
asyncio.run(self.run_async())
8185

8286

8387
class TestGSSAPI(unittest.TestCase):

0 commit comments

Comments
 (0)