[tracker] functional-tests: Allow to run one specific .expected file in the 400-extractor.py



commit aee956c42d4285f1eeaa3a641d68f3f5a255a156
Author: Ivan Frade <ivan frade gmail com>
Date:   Wed Aug 24 17:16:25 2011 +0300

    functional-tests: Allow to run one specific .expected file in the 400-extractor.py

 tests/functional-tests/400-extractor.py |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/tests/functional-tests/400-extractor.py b/tests/functional-tests/400-extractor.py
index d8e3eae..039094f 100755
--- a/tests/functional-tests/400-extractor.py
+++ b/tests/functional-tests/400-extractor.py
@@ -213,7 +213,7 @@ class ExtractionTestCase (ut.TestCase):
                                                           section))
 
 
-if __name__ == "__main__":
+def run_all ():
     ##
     # Traverse the TEST_DATA_PATH directory looking for .description files
     # Add a new TestCase to the suite per .description file and run the suite.
@@ -237,3 +237,26 @@ if __name__ == "__main__":
     result = ut.TextTestRunner (verbosity=1).run (extractionTestSuite)
     sys.exit(not result.wasSuccessful())
 
+def run_one (filename):
+    ##
+    # Run just one .description file
+    ##
+    description = os.path.join (os.getcwd (), filename) 
+
+    extractionTestSuite = ut.TestSuite ()
+    tc = ExtractionTestCase(descfile=description)
+    extractionTestSuite.addTest(tc)
+
+    result = ut.TextTestRunner (verbosity=2).run (extractionTestSuite)
+    sys.exit(not result.wasSuccessful())
+
+
+if __name__ == "__main__":
+    if (len (sys.argv) == 1):
+        run_all ()
+    else:
+        if os.path.exists (sys.argv[1]) and sys.argv[1].endswith (".expected"):
+            run_one (sys.argv[1])
+        else:
+            print "Usage: %s [FILE.expected]" % (sys.argv[1])
+        



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