X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=tests%2Ftest_timer.py;h=ea8b0bdbfeef40282f707a2d3784020e3ed9cda7;hp=2ee76f10e2eeda33a666ad03657bfbe0517acb6f;hb=441ac3dbbc2c5dfd21b09b00f6d376a115ac32a5;hpb=b453df5d17063ed3573e16211299f6f4596534a3 diff --git a/tests/test_timer.py b/tests/test_timer.py index 2ee76f1..ea8b0bd 100644 --- a/tests/test_timer.py +++ b/tests/test_timer.py @@ -2,18 +2,32 @@ import enigma import sys import time +import tests + #enigma.reset() -def test_timer(repeat = 0, timer_start = 10, timer_length = 100): - import RecordTimer +def test_timer(repeat = 0, timer_start = 3600, timer_length = 1000, sim_length = 86400 * 7): + + import NavigationInstance at = time.time() - t = RecordTimer.RecordTimer() + t = NavigationInstance.instance.RecordTimer + print t + print "old mwt:", t.MaxWaitTime + t.MaxWaitTime = 86400 * 1000 + + # hack: + NavigationInstance.instance.SleepTimer.MaxWaitTime = 86400 * 1000 + + t.processed_timers = [ ] + t.timer_list = [ ] + # generate a timer to test - import xml.dom.minidom + import xml.etree.cElementTree + import RecordTimer - timer = RecordTimer.createTimer(xml.dom.minidom.parseString( + timer = RecordTimer.createTimer(xml.etree.cElementTree.fromstring( """ """ % (at + timer_start, at + timer_start + timer_length, repeat) - ).childNodes[0]) + )) t.record(timer) # run virtual environment - enigma.run(4 * 86400) + enigma.run(sim_length) print "done." @@ -54,7 +68,12 @@ def test_timer(repeat = 0, timer_start = 10, timer_length = 100): print t_initial print t_repeated -# assert t_initial[3:6] == t_repeated[3:6], "repeated timer time of day does not match" + if t_initial[3:6] != t_repeated[3:6]: + raise tests.TestError("repeated timer time of day does not match") + +import FakeNotifications +#sys.modules["Tools.Notifications"] = FakeNotifications +#sys.modules["Tools.NumericalTextInput.NumericalTextInput"] = FakeNotifications # required stuff for timer (we try to keep this minimal) enigma.init_nav() @@ -62,9 +81,6 @@ enigma.init_record_config() enigma.init_parental_control() -import FakeNotifications -sys.modules["Notifications"] = FakeNotifications - from events import log import calendar @@ -75,5 +91,6 @@ import os os.environ['TZ'] = 'CET' time.tzset() -log(test_timer, base_time = calendar.timegm((2007, 3, 24, 12, 0, 0)), repeat=0x7f) -#log(test_timer, base_time = calendar.timegm((2007, 03, 20, 0, 0, 0)), repeat=0x7f) +#log(test_timer, test_name = "test_timer_repeating", base_time = calendar.timegm((2007, 3, 1, 12, 0, 0)), repeat=0x7f, sim_length = 86400 * 7) +log(test_timer, test_name = "test_timer_repeating_dst_skip", base_time = calendar.timegm((2007, 03, 20, 0, 0, 0)), timer_start = 3600, repeat=0x7f, sim_length = 86400 * 7) +#log(test_timer, test_name = "test_timer_repeating_dst_start", base_time = calendar.timegm((2007, 03, 20, 0, 0, 0)), timer_start = 10000, repeat=0x7f, sim_length = 86400 * 7)