check:
${PYTHON} ${srcdir}/alltests
-EXTRA_DIST=alltests dtest.py nothing.py version.py dbversion.py search.py
+EXTRA_DIST=alltests dtest.py nothing.py version.py dbversion.py search.py \
+ queue.py
dtest.copyfile(configsave, config)
print "Testing daemon manages to upgrade..."
dtest.start_daemon()
- assert dtest.check_files() == 0
+ assert dtest.check_files() == 0, "dtest.check_files"
if __name__ == '__main__':
dtest.run()
"""Utility module used by tests"""
-import os,os.path,subprocess,sys,re,time,unicodedata
+import os,os.path,subprocess,sys,re,time,unicodedata,random
def fatal(s):
"""Write an error message and exit"""
def common_setup():
remove_dir(testroot)
os.mkdir(testroot)
+ global port
+ port = random.randint(49152, 65535)
open("%s/config" % testroot, "w").write(
- """player *.ogg shell 'echo "$TRACK" >> %s/played.log'
-home %s
+ """home %s
collection fs UTF-8 %s/tracks
scratch %s/scratch.ogg
gap 0
tracklength *.ogg disorder-tracklength
tracklength *.wav disorder-tracklength
tracklength *.flac disorder-tracklength
-""" % (testroot, testroot, testroot, testroot, top_builddir, top_builddir))
+speaker_backend network
+broadcast 127.0.0.1 %d
+broadcast_from 127.0.0.1 %d
+""" % (testroot, testroot, testroot, top_builddir, top_builddir,
+ port, port + 1))
copyfile("%s/sounds/scratch.ogg" % top_srcdir,
"%s/scratch.ogg" % testroot)
Start the daemon."""
global daemon, errs
- assert daemon == None
+ assert daemon == None, "no daemon running"
print " starting daemon"
# remove the socket if it exists
socket = "%s/socket" % testroot
except AssertionError, e:
global failures
failures += 1
- print e
+ print "assertion failed: %s" % e.message
finally:
stop_daemon()
if report:
def test():
"""Check that the file listing comes out right"""
dtest.start_daemon()
- assert dtest.check_files() == 0
+ assert dtest.check_files() == 0, "dtest.check_files"
if __name__ == '__main__':
dtest.run()
--- /dev/null
+#! /usr/bin/env python
+#
+# This file is part of DisOrder.
+# Copyright (C) 2007 Richard Kettlewell
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+import dtest,time,disorder
+
+def test():
+ """Ask the server its version number"""
+ dtest.start_daemon()
+ c = disorder.client()
+ q = c.queue()
+ assert len(q) == 10, "queue is at proper length"
+
+if __name__ == '__main__':
+ dtest.run()