_configfile = "pkgconfdir/config"
_dbhome = "pkgstatedir"
+_userconf = True
# various regexps we'll use
_ws = re.compile(r"^[ \t\n\r]+")
self._readfile(_configfile)
if os.path.exists(privconf):
self._readfile(privconf)
- if os.path.exists(passfile):
+ if os.path.exists(passfile) and _userconf:
self._readfile(passfile)
self.state = 'disconnected'
topsrcdir=${top_srcdir} \
${PYTHON} ${srcdir}/alltests
-EXTRA_DIST=alltests dtest.py nothing.py
+EXTRA_DIST=alltests dtest.py nothing.py version.py
"""Utility module used by tests"""
-import os,os.path,subprocess,sys
+import os,os.path,subprocess,sys,disorder
def copyfile(a,b):
"""copyfile(A, B)
"--foreground",
"--config", "%s/config" % testroot],
stderr=errs)
+ disorder._configfile = "%s/config" % testroot
+ disorder._userconf = False
def stop():
"""stop()
global daemon
rc = daemon.poll()
if rc == None:
+ print " stopping daemon"
os.kill(daemon.pid, 15)
rc = daemon.wait()
print " daemon has stopped"
setup()
start(name)
try:
- test()
- except AssertionError, e:
- global failures
- failures += 1
- print e
-
- stop()
+ try:
+ test()
+ except AssertionError, e:
+ global failures
+ failures += 1
+ print e
+ finally:
+ stop()
if report:
if failures:
print " FAILED"
stopword 11 12 13 14 15 16 17 18 19 20
stopword 21 22 23 24 25 26 27 28 29 30
stopword the a an and to too in on of we i am as im for is
+username fred
+password fredpass
+allow fred fredpass
""" % (testroot, testroot, testroot, testroot))
copyfile("%s/sounds/scratch.ogg" % topsrcdir,
"%s/scratch.ogg" % testroot)
--- /dev/null
+#! /usr/bin/env python
+import dtest,time,disorder
+
+def test():
+ """Ask the server its version number"""
+ time.sleep(2) # give the daemon a chance to start up
+ c = disorder.client()
+ v = c.version()
+ print "Server version: %s" % v
+
+if __name__ == '__main__':
+ dtest.run(test)