Patchwork [078,of,179,tests-refactor] run-tests: move test discovery into TestRunner.run()

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:38 p.m.
Message ID <0d99fc077685f2eeaa8b.1399055915@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4574/
State Accepted
Commit e478a9aab533b55e7dc1e55d94d8a9b9f846eaa5
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:38 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1398013455 25200
#      Sun Apr 20 10:04:15 2014 -0700
# Branch stable
# Node ID 0d99fc077685f2eeaa8b4f5f78763d581cb2480c
# Parent  1da4323a9c6cdcf34e7f15e34fdecb3cf5086910
run-tests: move test discovery into TestRunner.run()

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1007,22 +1007,24 @@  class TestRunner(object):
             '!': [],
             '~': [],
             's': [],
             'i': [],
         }
         self.abort = [False]
         self._createdfiles = []
 
-    def run(self, tests):
+    def run(self, args):
         """Run the test suite."""
 
         # Be kind and try to clean up after ourselves.
         oldenv = dict(os.environ)
         try:
+            tests = self.findtests(args)
+
             return self._run(tests)
         finally:
             os.environ.clear()
             os.environ.update(oldenv)
 
     def _run(self, tests):
         if self.options.random:
             random.shuffle(tests)
@@ -1461,14 +1463,12 @@  def main(args, runner=None, parser=None)
 
     parser = parser or getparser()
     (options, args) = parseargs(args, parser)
     runner.options = options
     os.umask(022)
 
     runner.checktools()
 
-    tests = runner.findtests(args)
-
-    return runner.run(tests)
+    return runner.run(args)
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))