aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_examples.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/test_examples.py b/test/test_examples.py
index 226835f..a3c234f 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -14,7 +14,8 @@ import shutil
import filecmp
import errno
from tempfile import NamedTemporaryFile
-from util import wait_for_mount, umount, cleanup, base_cmdline
+from util import (wait_for_mount, umount, cleanup, base_cmdline,
+ safe_sleep)
from os.path import join as pjoin
basename = pjoin(os.path.dirname(__file__), '..')
@@ -168,6 +169,35 @@ def test_fsel(tmpdir):
else:
umount(mount_process, mnt_dir)
+@pytest.mark.parametrize("name", ('timefs1', 'timefs2'))
+@pytest.mark.parametrize("options", LL_OPTIONS)
+@pytest.mark.parametrize("notify", (True, False))
+def test_timefs(tmpdir, name, options, notify):
+ mnt_dir = str(tmpdir)
+ cmdline = base_cmdline + \
+ [ pjoin(basename, 'example', name),
+ '-f', '--update-interval=1', mnt_dir ] + options
+ if not notify:
+ cmdline.append('--no-notify')
+ mount_process = subprocess.Popen(cmdline)
+ try:
+ wait_for_mount(mount_process, mnt_dir)
+ filename = pjoin(mnt_dir, 'current_time')
+ with open(filename, 'r') as fh:
+ read1 = fh.read()
+ safe_sleep(2)
+ with open(filename, 'r') as fh:
+ read2 = fh.read()
+ if notify:
+ assert read1 != read2
+ else:
+ assert read1 == read2
+ except:
+ cleanup(mnt_dir)
+ raise
+ else:
+ umount(mount_process, mnt_dir)
+
def checked_unlink(filename, path, isdir=False):
fullname = pjoin(path, filename)
if isdir: