[pitivi] tests/runtests.py: allow running single test through TESTCASE env var



commit 7e38a09427c27e7dddd593abfda041eff2ad0c33
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Fri Mar 5 23:44:28 2010 -0800

    tests/runtests.py: allow running single test through TESTCASE env var
    
    can be module, class, or method name.

 tests/runtests.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/tests/runtests.py b/tests/runtests.py
index 6b672ff..694f01a 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -19,8 +19,15 @@ def gettestnames(which):
 suite = unittest.TestSuite()
 loader = unittest.TestLoader()
 
-for name in gettestnames(sys.argv[1:]):
-    suite.addTest(loader.loadTestsFromName(name))
+TEST_CASE=os.getenv("TESTCASE")
+
+if TEST_CASE:
+    suite.addTest(loader.loadTestsFromName(TEST_CASE))
+    if not suite._tests:
+        raise Exception("could not find test case %r" % TEST_CASE)
+else:
+    for name in gettestnames(sys.argv[1:]):
+        suite.addTest(loader.loadTestsFromName(name))
 
 descriptions = 1
 verbosity = 1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]