changeset 21382:4b8ffe3abdd2

run-tests: move createhgrc into Test
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Apr 2014 10:24:00 -0700
parents 9aa5784992d4
children 772ed56e2519
files tests/run-tests.py
diffstat 1 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sun Apr 20 10:19:58 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 10:24:00 2014 -0700
@@ -312,25 +312,6 @@
     sys.stdout.flush()
     iolock.release()
 
-def createhgrc(path, options):
-    # create a fresh hgrc
-    hgrc = open(path, 'w')
-    hgrc.write('[ui]\n')
-    hgrc.write('slash = True\n')
-    hgrc.write('interactive = False\n')
-    hgrc.write('[defaults]\n')
-    hgrc.write('backout = -d "0 0"\n')
-    hgrc.write('commit = -d "0 0"\n')
-    hgrc.write('shelve = --date "0 0"\n')
-    hgrc.write('tag = -d "0 0"\n')
-    if options.extra_config_opt:
-        for opt in options.extra_config_opt:
-            section, key = opt.split('.', 1)
-            assert '=' in key, ('extra config opt %s must '
-                                'have an = for assignment' % opt)
-            hgrc.write('[%s]\n%s\n' % (section, key))
-    hgrc.close()
-
 def terminate(proc):
     """Terminate subprocess (with fallback for Python versions < 2.6)"""
     vlog('# Terminating process %d' % proc.pid)
@@ -422,7 +403,7 @@
         replacements, port = self._getreplacements(testtmp)
         env = self._getenv(testtmp, port)
         self._daemonpids.append(env['DAEMON_PIDS'])
-        createhgrc(env['HGRCPATH'], options)
+        self._createhgrc(env['HGRCPATH'])
 
         vlog('# Test', self._test)
 
@@ -568,6 +549,25 @@
 
         return env
 
+    def _createhgrc(self, path):
+        # create a fresh hgrc
+        hgrc = open(path, 'w')
+        hgrc.write('[ui]\n')
+        hgrc.write('slash = True\n')
+        hgrc.write('interactive = False\n')
+        hgrc.write('[defaults]\n')
+        hgrc.write('backout = -d "0 0"\n')
+        hgrc.write('commit = -d "0 0"\n')
+        hgrc.write('shelve = --date "0 0"\n')
+        hgrc.write('tag = -d "0 0"\n')
+        if self._options.extra_config_opt:
+            for opt in self._options.extra_config_opt:
+                section, key = opt.split('.', 1)
+                assert '=' in key, ('extra config opt %s must '
+                                    'have an = for assignment' % opt)
+                hgrc.write('[%s]\n%s\n' % (section, key))
+        hgrc.close()
+
     def success(self):
         return '.', self._test, ''