note rollover problem in unit tests

This commit is contained in:
Damien Elmes 2013-10-02 04:04:06 +09:00
parent 621ba0e1ac
commit ec3850aab2

View file

@ -1,10 +1,15 @@
# coding: utf-8 # coding: utf-8
import time, copy import time, copy, sys
from tests.shared import getEmptyDeck from tests.shared import getEmptyDeck
from anki.utils import intTime from anki.utils import intTime
from anki.hooks import addHook from anki.hooks import addHook
def test_clock():
d = getEmptyDeck()
if (d.sched.dayCutoff - intTime()) < 10*60:
raise Exception("Unit tests will fail around the day rollover.")
def checkRevIvl(d, c, targetIvl): def checkRevIvl(d, c, targetIvl):
min, max = d.sched._fuzzIvlRange(targetIvl) min, max = d.sched._fuzzIvlRange(targetIvl)
return min <= c.ivl <= max return min <= c.ivl <= max