From 01ebf8fba785c94053fb2d85ac317b4de3659e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 6 Mar 2017 11:54:03 +0100 Subject: [PATCH] Fix for two timing sensitive unit tests --- tests/settings/test_settings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/settings/test_settings.py b/tests/settings/test_settings.py index 9455c179..7ce753cb 100644 --- a/tests/settings/test_settings.py +++ b/tests/settings/test_settings.py @@ -17,6 +17,7 @@ import tempfile import yaml import hashlib import ddt +import time import octoprint.settings @@ -527,6 +528,9 @@ class TestSettings(unittest.TestCase): # current modification date of config.yaml current_modified = os.stat(config_path).st_mtime + # sleep a bit to make sure we do have a change in the timestamp + time.sleep(1.0) + # set a new value settings.set(["api", "key"], "newkey") @@ -542,6 +546,9 @@ class TestSettings(unittest.TestCase): settings = octoprint.settings.Settings() last_modified = settings.last_modified + # sleep a bit to make sure we do have a change in the timestamp + time.sleep(1.0) + settings.save() self.assertEqual(settings.last_modified, last_modified)