loop.time is not usable on advance time, use wall time
This commit is contained in:
parent
9b3b609e40
commit
c519d4651b
1 changed files with 3 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
import typing
|
import typing
|
||||||
from lbry.testcase import AsyncioTestCase
|
from lbry.testcase import AsyncioTestCase
|
||||||
|
@ -95,8 +96,8 @@ class TestTemporarilyLosingConnection(AsyncioTestCase):
|
||||||
TIMEOUT = None # not supported as it advances time
|
TIMEOUT = None # not supported as it advances time
|
||||||
async def test_losing_connection(self):
|
async def test_losing_connection(self):
|
||||||
async def wait_for(check_ok, insist, timeout=20):
|
async def wait_for(check_ok, insist, timeout=20):
|
||||||
start = loop.time()
|
start = time.time()
|
||||||
while loop.time() - start < timeout:
|
while time.time() - start < timeout:
|
||||||
if check_ok():
|
if check_ok():
|
||||||
break
|
break
|
||||||
await asyncio.sleep(0)
|
await asyncio.sleep(0)
|
||||||
|
|
Loading…
Reference in a new issue