From 9791bcb36b60ef3af7b4f926426687f4bac2e8ae Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 25 Dec 2019 14:08:04 +1000 Subject: [PATCH] more tests fail close to 4am; automatically adjust the time instead --- tests/test_schedv2.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_schedv2.py b/tests/test_schedv2.py index 1cff4cbe6..f3825027b 100644 --- a/tests/test_schedv2.py +++ b/tests/test_schedv2.py @@ -8,6 +8,14 @@ from tests.shared import getEmptyCol from anki.utils import intTime from anki.hooks import addHook +# Between 2-4AM, shift the time back so test assumptions hold. +lt = time.localtime() +if lt.tm_hour > 2 and lt.tm_hour < 4: + orig_time = time.time + def adjusted_time(): + return orig_time() - 60*60*2 + time.time = adjusted_time + def test_clock(): d = getEmptyCol() if (d.sched.dayCutoff - intTime()) < 10*60: @@ -705,9 +713,6 @@ def test_filt_reviewing_early_normal(): def test_filt_keep_lrn_state(): d = getEmptyCol() - if (d.sched.dayCutoff - time.time()) < 60*60*3: - print("test_filt_keep_lrn_state disabled due to time of day") - return f = d.newNote() f['Front'] = "one"