Commit 50b124ae authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[master] Fix test: remove sleep, use fake mtime

parent e8e45c21
......@@ -580,12 +580,11 @@ class TestSecureHTTPServer(unittest.TestCase):
self.server._create_user_info(accounts_file)
self.assertEqual(fake_users_val, self.server._user_infos)
# Yes sleep sucks, but in this case we need it to check for
# a changed mtime, not for some thread to do its work
# (do we run these tests on systems with 1+ secs mtimes?)
time.sleep(0.1)
# create the file again, this time read should not be a noop
with TmpTextFile(accounts_file, ['otherroot,foo,bar']):
# Set mtime in future
stat = os.stat(accounts_file)
os.utime(accounts_file, (stat.st_atime, stat.st_mtime + 10))
self.server._create_user_info(accounts_file)
self.assertEqual(1, len(self.server._user_infos))
self.assertTrue('otherroot' in self.server._user_infos)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment