Patchwork [076,of,179,tests-refactor] run-test: assign testdir in TestRunner

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:38 p.m.
Message ID <89428680c8a1ced4cdc1.1399055913@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4571/
State Deferred
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:38 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1398013259 25200
#      Sun Apr 20 10:00:59 2014 -0700
# Branch stable
# Node ID 89428680c8a1ced4cdc1f1d816db9d974fa17d10
# Parent  335f0364ed5aee334971d46f7fa95c4ece17b732
run-test: assign testdir in TestRunner

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1019,16 +1019,18 @@  class TestRunner(object):
         oldenv = dict(os.environ)
         try:
             return self._run(tests)
         finally:
             os.environ.clear()
             os.environ.update(oldenv)
 
     def _run(self, tests):
+        self.testdir = os.environ['TESTDIR'] = os.getcwd()
+
         if 'PYTHONHASHSEED' not in os.environ:
             # use a random python hash seed all the time
             # we do the randomness ourself to know what seed is used
             os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32))
 
         if self.options.tmpdir:
             self.options.keep_tmpdir = True
             tmpdir = self.options.tmpdir
@@ -1461,14 +1463,12 @@  def main(args, runner=None, parser=None)
                     raise
                 return -1e9 # file does not exist, tell early
             for kw in slow:
                 if kw in f:
                     val *= 10
             return val
         tests.sort(key=sortkey)
 
-    runner.testdir = os.environ['TESTDIR'] = os.getcwd()
-
     return runner.run(tests)
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))