Skip to content

Commit 141b9ae

Browse files
committed
modified run for thread pt 3
1 parent f4ed34a commit 141b9ae

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

test/asynchronous/test_auth.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,16 @@ def __init__(self, collection):
7777
self.success = False
7878

7979
def run(self):
80-
async def _run_async():
81-
assert await self.collection.find_one({"$where": delay(1)}) is not None
80+
if _IS_SYNC:
81+
assert self.collection.find_one({"$where": delay(1)}) is not None
8282
self.success = True
83+
else:
84+
85+
async def _run_async():
86+
assert await self.collection.find_one({"$where": delay(1)}) is not None
87+
self.success = True
8388

84-
asyncio.run(_run_async())
89+
asyncio.run(_run_async())
8590

8691

8792
class TestGSSAPI(unittest.IsolatedAsyncioTestCase):

test/test_auth.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,16 @@ def __init__(self, collection):
7777
self.success = False
7878

7979
def run(self):
80-
def _run_async():
80+
if _IS_SYNC:
8181
assert self.collection.find_one({"$where": delay(1)}) is not None
8282
self.success = True
83+
else:
84+
85+
def _run_async():
86+
assert self.collection.find_one({"$where": delay(1)}) is not None
87+
self.success = True
8388

84-
asyncio.run(_run_async())
89+
asyncio.run(_run_async())
8590

8691

8792
class TestGSSAPI(unittest.TestCase):

0 commit comments

Comments
 (0)