Test improvements

This commit is contained in:
Aaron Heise 2023-02-18 07:39:00 -06:00
parent 2b3089ddd5
commit 1f31307307
3 changed files with 24 additions and 11 deletions

View file

@ -1,4 +1,5 @@
import logging
import time
import types
import typing
import tempfile
@ -147,4 +148,16 @@ def test_config_and_cleanup():
assert filedata.index("acehoss test config") > 0
with pytest.raises(ValueError):
filedata.index("22222")
assert not os.path.exists(os.path.join(td, "config"))
assert not os.path.exists(os.path.join(td, "config"))
def wait_for_condition(condition: callable, timeout: float):
tm = time.time() + timeout
while tm > time.time() and not condition():
time.sleep(0.01)
async def wait_for_condition_async(condition: callable, timeout: float):
tm = time.time() + timeout
while tm > time.time() and not condition():
await asyncio.sleep(0.01)