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

added devserver

This commit is contained in:
Bastian Venthur
2021-03-19 11:22:11 +01:00
parent b077e22984
commit dc6547290b
2 changed files with 43 additions and 45 deletions

30
tests/test_devserver.py Normal file
View File

@@ -0,0 +1,30 @@
import time
import pytest
from tempfile import TemporaryDirectory
from blag import devserver
@pytest.fixture
def tempdir():
with TemporaryDirectory() as dir:
yield dir
def test_get_last_modified(tempdir):
# take initial time
t1 = devserver.get_last_modified([tempdir])
# wait a bit, create a file and measure again
time.sleep(0.1)
with open(f'{tempdir}/test', 'w') as fh:
fh.write('boo')
t2 = devserver.get_last_modified([tempdir])
# wait a bit and take time again
time.sleep(0.1)
t3 = devserver.get_last_modified([tempdir])
assert t2 > t1
assert t2 == t3