Add --discover-pattern.
authorJames Westby <james.westby@canonical.com>
Mon, 7 Jun 2010 18:37:52 +0000 (19:37 +0100)
committerJames Westby <james.westby@canonical.com>
Mon, 7 Jun 2010 18:37:52 +0000 (19:37 +0100)
python/subunit/run.py

index 5c440eb9bd796a6b808dc98a3f33df5e6652cf7a..7925512ff988eac1215b5a4008a17f4f81ad129c 100755 (executable)
@@ -49,6 +49,9 @@ if __name__ == '__main__':
     if has_discover:
         parser.add_option("--discover", dest="discover", action="store_true",
                 help="Use test discovery on the given testspec.")
+        parser.add_option("--discover-pattern", dest="discover_pattern",
+                help="The pattern that discovery should match. Default "
+                "'test*.py'", default="test*.py")
     options, args = parser.parse_args()
     stream = get_default_formatter()
     runner = SubunitTestRunner(stream)
@@ -56,7 +59,8 @@ if __name__ == '__main__':
         loader = discover.DiscoveringTestLoader()
         test = TestSuite()
         for arg in args:
-            test.addTest(loader.discover(arg))
+            test.addTest(loader.discover(
+                    arg, pattern=options.discover_pattern))
         result = runner.run(test)
         sys.exit(not result.wasSuccessful())
     program = TestProgram(module=None, argv=[sys.argv[0]] + args,