test: added directory option to planpythontestsuite()
authorAndrew Tridgell <tridge@samba.org>
Wed, 9 Nov 2011 02:10:24 +0000 (13:10 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 10 Nov 2011 03:24:21 +0000 (14:24 +1100)
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>

selftest/selftesthelpers.py

index 085c62c46602b38ef15c76bf565b700977dfe174..58a2f0f5d67b85229b399350011be76cc5d43a3b 100644 (file)
@@ -158,10 +158,17 @@ def planperltestsuite(name, path):
         skiptestsuite(name, "Test::More not available")
 
 
-def planpythontestsuite(env, module):
+def planpythontestsuite(env, module, name=None, directory=None):
+
+    if name is None:
+        name = module
     if has_system_subunit_run:
-        plantestsuite_idlist(module, env, [python, "-m", "subunit.run", "$LISTOPT", module])
+        cmd = [python, "-m", "subunit.run", "$LISTOPT", module]
+        if directory is not None:
+            cmd.extend(['-D', directory])
+        plantestsuite_idlist(name, env, cmd)
     else:
-        plantestsuite_idlist(module, env, "PYTHONPATH=$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools %s -m subunit.run $LISTOPT %s" % (srcdir(), srcdir(), python, module))
-
-
+        cmd = "PYTHONPATH=$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools %s -m subunit.run $LISTOPT %s" % (srcdir(), srcdir(), python, module)
+        if directory is not None:
+            cmd += ' -D %s' % directory
+        plantestsuite_idlist(name, env, cmd)