[PATCH 005 of 179 tests-refactor] run-tests: move createhgrc() call into Test.run()

Gregory Szorc gregory.szorc at gmail.com
Fri May 2 13:37:22 CDT 2014


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1397938309 25200
#      Sat Apr 19 13:11:49 2014 -0700
# Branch stable
# Node ID 27f7274d1694f92571e68c63696cead7658271eb
# Parent  71520e4115ab64e38cc872ec04044f37c747ffcf
run-tests: move createhgrc() call into Test.run()

createhgrc() is an implementation detail of how tests are run. It makes
sense to move it into Test.run().

Note that this will cause the test execution time to include the
creation of hgrc. The author does not believe this is a significant
change worth worrying about.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -549,16 +549,18 @@ class Test(object):
         self._path = path
         self._options = options
         self._threadtmp = threadtmp
 
         self.testtmp = os.path.join(threadtmp, os.path.basename(path))
         os.mkdir(self.testtmp)
 
     def run(self, replacements, env):
+        createhgrc(env['HGRCPATH'], self._options)
+
         return self._run(replacements, env)
 
     def _run(self, replacements, env):
         raise NotImplemented('Subclasses must implement Test.run()')
 
     def getreplacements(self, count):
         port = self._options.port + count * 3
         r = [
@@ -1013,17 +1015,16 @@ def runone(options, test, count):
 
     # Make a tmp subdirectory to work in
     threadtmp = os.path.join(HGTMP, "child%d" % count)
     os.mkdir(threadtmp)
 
     t = runner(testpath, options, threadtmp)
     replacements, port = t.getreplacements(count)
     env = t.getenv(port)
-    createhgrc(env['HGRCPATH'], options)
 
     starttime = time.time()
     try:
         ret, out = t.run(replacements, env)
     except KeyboardInterrupt:
         endtime = time.time()
         log('INTERRUPTED: %s (after %d seconds)' % (test, endtime - starttime))
         raise


More information about the Mercurial-devel mailing list