mirror of
https://github.com/venthur/blag.git
synced 2025-11-25 12:42:41 +00:00
added devserver
This commit is contained in:
30
tests/test_devserver.py
Normal file
30
tests/test_devserver.py
Normal 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
|
||||
Reference in New Issue
Block a user