1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00

remove warning in test due to threading race condition we don´t care

about
This commit is contained in:
Bastian Venthur
2021-11-06 14:51:46 +01:00
parent 4f1632e3cd
commit 78316725cf
2 changed files with 5 additions and 3 deletions

View File

@@ -72,7 +72,7 @@ def autoreload(args):
mtime = get_last_modified(dirs) mtime = get_last_modified(dirs)
if mtime > last_mtime: if mtime > last_mtime:
last_mtime = mtime last_mtime = mtime
logger.debug('Change detected, rebuilding...') logger.info('Change detected, rebuilding...')
blag.build(args) blag.build(args)
time.sleep(1) time.sleep(1)

View File

@@ -1,6 +1,8 @@
import time import time
import threading import threading
import pytest
from blag import devserver from blag import devserver
@@ -42,6 +44,7 @@ def test_autoreload_builds_immediately(args):
assert t1 > t0 assert t1 > t0
@pytest.mark.filterwarnings("ignore::pytest.PytestUnhandledThreadExceptionWarning") # noqa
def test_autoreload(args): def test_autoreload(args):
t = threading.Thread(target=devserver.autoreload, t = threading.Thread(target=devserver.autoreload,
args=(args, ), args=(args, ),
@@ -54,11 +57,10 @@ def test_autoreload(args):
with open('content/test.md', 'w') as fh: with open('content/test.md', 'w') as fh:
fh.write('boo') fh.write('boo')
# try for 5 seconds... # try for 5 seconds to see if we rebuild once...
for i in range(5): for i in range(5):
time.sleep(1) time.sleep(1)
t1 = devserver.get_last_modified(['build']) t1 = devserver.get_last_modified(['build'])
print(t1)
if t1 > t0: if t1 > t0:
break break
assert t1 > t0 assert t1 > t0