1. michilu
  2. fanstatic-dummy

Commits

Jan-Jaap Driessen  committed 1cfd0ec

Sleep extra long on file systems that report mtime in seconds instead of milliseconds. Let's hope this fixes the buildbots on different platforms.

  • Participants
  • Parent commits 9f69ab3
  • Branches default

Comments (0)

Files changed (2)

File fanstatic/test_checksum.py

View file
 
 def test_mtime(tmpdir):
     testdata_path = str(_copy_testdata(tmpdir))
+    sleep = 0.02
+    # Sleep extra long on filesystems that report in seconds
+    # instead of milliseconds.
+    if os.path.getmtime(os.curdir).is_integer():
+        sleep += 1
 
     # Compute a first mtime for the test package:
     mtime_start = mtime(testdata_path)
     assert mtime_after_add != mtime_start
 
     # Remove the file again, the mtime changed:
-    time.sleep(0.02) 
+    time.sleep(sleep) 
     tmpdir.join('/MyPackage/A').remove()
     mtime_after_remove = mtime(testdata_path)
     assert mtime_after_remove != mtime_after_add
     tmpdir.join('/MyPackage/B').write('Contents for B')
     mtime_start = mtime(testdata_path)
     # Wait a split second in order to let the disk catch up.
-    time.sleep(0.02)
+    time.sleep(sleep)
     tmpdir.join('/MyPackage/B').write('Contents for B have changed')
     assert mtime(testdata_path) != mtime_start
     tmpdir.join('/MyPackage/B').remove()
 
     # Moving, or renaming a file should change the mtime:
     mtime_start = mtime(testdata_path)
-    time.sleep(0.02)
+    time.sleep(sleep)
     tmpdir.join('/MyPackage/setup.py').rename(
         tmpdir.join('/MyPackage/setup.py.renamed'))
     expected = [

File fanstatic/test_core.py

View file
 from __future__ import with_statement
+import os
 import re
 import pytest
 import time
 
     # now create a file
     resource = tmpdir.join('test.js')
+
     time.sleep(0.02)
+    # Sleep extra long on filesystems that report in seconds
+    # instead of milliseconds.
+    if os.path.getmtime(os.curdir).is_integer():
+        time.sleep(1)
     resource.write('/* test */')
 
     # the hash is recalculated now, so it changes