From 61192f93e8b149c540afe507a62bf1f4eae31149 Mon Sep 17 00:00:00 2001 Message-Id: <61192f93e8b149c540afe507a62bf1f4eae31149.1715411849.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 19 Apr 2008 19:22:46 +0100 Subject: [PATCH] Fix test/queue.py to cope with slower random queue refill. Organization: Straylight/Edgeware From: Richard Kettlewell --- tests/dtest.py | 1 + tests/queue.py | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/tests/dtest.py b/tests/dtest.py index fff1866..c37872d 100644 --- a/tests/dtest.py +++ b/tests/dtest.py @@ -173,6 +173,7 @@ def default_config(encoding="UTF-8"): collection fs %s %s/tracks scratch %s/scratch.ogg gap 0 +queue_pad 5 stopword 01 02 03 04 05 06 07 08 09 10 stopword 1 2 3 4 5 6 7 8 9 stopword 11 12 13 14 15 16 17 18 19 20 diff --git a/tests/queue.py b/tests/queue.py index 7ed10a0..dae37b4 100755 --- a/tests/queue.py +++ b/tests/queue.py @@ -20,25 +20,29 @@ # import dtest,time,disorder,re +class wait_monitor(disorder.monitor): + def queue(self, q): + return False + def test(): """Check the queue is padded to the (default) configured length""" dtest.start_daemon() dtest.create_user() - print " waiting for queue to be populated..." - class wait_monitor(disorder.monitor): - def queue(self, q): - return False - wait_monitor().run() c = disorder.client() - print " getting queue via python module" + print " disabling play" + c.disable() + print " waiting for queue to be populated..." q = c.queue() - assert len(q) == 10, "queue is at proper length" + while len(q) < 5: + print " queue at %d tracks" % len(q) + wait_monitor().run() + q = c.queue() print " getting queue via disorder(1)" q = dtest.command(["disorder", "--config", disorder._configfile, "--no-per-user-config", "queue"]) tracks = filter(lambda s: re.match("^track", s), q) - assert len(tracks) == 10, "queue is at proper length" + assert len(tracks) == 5, "queue is at proper length" print " disabling random play" c.random_disable() print " emptying queue" @@ -49,9 +53,12 @@ def test(): assert q == [], "checking queue is empty" print " enabling random play" c.random_enable() - print " checking queue refills" + print " waiting for queue to refill..." q = c.queue() - assert len(q) == 10, "queue is at proper length" + while len(q) < 5: + print " queue at %d tracks" % len(q) + wait_monitor().run() + q = c.queue() print " disabling all play" c.random_disable() c.disable() -- [mdw]