Skip to content
Snippets Groups Projects
Commit f593b7bb authored by Thomas Holene Løkkeborg's avatar Thomas Holene Løkkeborg
Browse files

#112 øker delta i alle tester & parameteriserer delta

parent 7edf7257
No related branches found
No related tags found
1 merge request!63#112 øker delta på QTimer test
Pipeline #80590 failed
...@@ -17,6 +17,8 @@ TESTDBPATH = os.path.join(SOITOOL_DIR, TESTDBNAME) ...@@ -17,6 +17,8 @@ TESTDBPATH = os.path.join(SOITOOL_DIR, TESTDBNAME)
TESTDATA_PATH = Path(__file__).parent.parent / "soitool/testdata" TESTDATA_PATH = Path(__file__).parent.parent / "soitool/testdata"
# Tolerance for timed tests. Tolrating DELTA seconds of difference
DELTA = 2
class DatabaseTest(unittest.TestCase): class DatabaseTest(unittest.TestCase):
"""Database tests.""" """Database tests."""
...@@ -141,7 +143,7 @@ class DatabaseTest(unittest.TestCase): ...@@ -141,7 +143,7 @@ class DatabaseTest(unittest.TestCase):
# Calculates difference in seconds # Calculates difference in seconds
time_diff = (second_time - first_time).total_seconds() time_diff = (second_time - first_time).total_seconds()
# Compares difference with sleep_time # Compares difference with sleep_time
self.assertAlmostEqual(time_diff, sleep_time, delta=2) self.assertAlmostEqual(time_diff, sleep_time, delta=DELTA)
def test_get_categories(self): def test_get_categories(self):
"""Assert function get_categories works as expected.""" """Assert function get_categories works as expected."""
...@@ -276,7 +278,7 @@ class DatabaseTest(unittest.TestCase): ...@@ -276,7 +278,7 @@ class DatabaseTest(unittest.TestCase):
expected_time = seconds_in_24h - sleep_time expected_time = seconds_in_24h - sleep_time
actual_time = self.database.seconds_to_next_update(seconds_in_24h) actual_time = self.database.seconds_to_next_update(seconds_in_24h)
# Compares expected and function return value with # Compares expected and function return value with
self.assertAlmostEqual(expected_time, actual_time, delta=0.2) self.assertAlmostEqual(expected_time, actual_time, delta=DELTA)
def teset_seconds_to_next_update_complete_period(self): def teset_seconds_to_next_update_complete_period(self):
"""Check that seconds to next update can returns 0 and not negative.""" """Check that seconds to next update can returns 0 and not negative."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment