##// END OF EJS Templates
run-tests: move extra config options to Test.__init__
Gregory Szorc -
r21515:9978ff48 default
parent child Browse files
Show More
@@ -341,7 +341,7 b' class Test(unittest.TestCase):'
341 def __init__(self, options, path, tmpdir, abort, keeptmpdir=False,
341 def __init__(self, options, path, tmpdir, abort, keeptmpdir=False,
342 debug=False, nodiff=False, diffviewer=None,
342 debug=False, nodiff=False, diffviewer=None,
343 interactive=False, timeout=defaults['timeout'],
343 interactive=False, timeout=defaults['timeout'],
344 startport=defaults['port']):
344 startport=defaults['port'], extraconfigopts=None):
345 """Create a test from parameters.
345 """Create a test from parameters.
346
346
347 options are parsed command line options that control test execution.
347 options are parsed command line options that control test execution.
@@ -373,6 +373,10 b' class Test(unittest.TestCase):'
373 test will reserve 3 port numbers for execution. It is the caller's
373 test will reserve 3 port numbers for execution. It is the caller's
374 responsibility to allocate a non-overlapping port range to Test
374 responsibility to allocate a non-overlapping port range to Test
375 instances.
375 instances.
376
377 extraconfigopts is an iterable of extra hgrc config options. Values
378 must have the form "key=value" (something understood by hgrc). Values
379 of the form "foo.key=value" will result in "[foo] key=value".
376 """
380 """
377
381
378 self.path = path
382 self.path = path
@@ -390,6 +394,7 b' class Test(unittest.TestCase):'
390 self._interactive = interactive
394 self._interactive = interactive
391 self._timeout = timeout
395 self._timeout = timeout
392 self._startport = startport
396 self._startport = startport
397 self._extraconfigopts = extraconfigopts or []
393 self._daemonpids = []
398 self._daemonpids = []
394
399
395 self._finished = None
400 self._finished = None
@@ -643,12 +648,11 b' class Test(unittest.TestCase):'
643 hgrc.write('commit = -d "0 0"\n')
648 hgrc.write('commit = -d "0 0"\n')
644 hgrc.write('shelve = --date "0 0"\n')
649 hgrc.write('shelve = --date "0 0"\n')
645 hgrc.write('tag = -d "0 0"\n')
650 hgrc.write('tag = -d "0 0"\n')
646 if self._options.extra_config_opt:
651 for opt in self._extraconfigopts:
647 for opt in self._options.extra_config_opt:
652 section, key = opt.split('.', 1)
648 section, key = opt.split('.', 1)
653 assert '=' in key, ('extra config opt %s must '
649 assert '=' in key, ('extra config opt %s must '
654 'have an = for assignment' % opt)
650 'have an = for assignment' % opt)
655 hgrc.write('[%s]\n%s\n' % (section, key))
651 hgrc.write('[%s]\n%s\n' % (section, key))
652 hgrc.close()
656 hgrc.close()
653
657
654 def fail(self, msg, ret):
658 def fail(self, msg, ret):
@@ -1517,7 +1521,8 b' class TestRunner(object):'
1517 diffviewer=self.options.view,
1521 diffviewer=self.options.view,
1518 interactive=self.options.interactive,
1522 interactive=self.options.interactive,
1519 timeout=self.options.timeout,
1523 timeout=self.options.timeout,
1520 startport=self.options.port + count * 3)
1524 startport=self.options.port + count * 3,
1525 extraconfigopts=self.options.extra_config_opt)
1521
1526
1522 def _cleanup(self):
1527 def _cleanup(self):
1523 """Clean up state from this test invocation."""
1528 """Clean up state from this test invocation."""
General Comments 0
You need to be logged in to leave comments. Login now