Mercurial > hg
comparison tests/run-tests.py @ 21518:8e8049b9bda4
run-tests: remove options from Test.__init__
All options are now passed as arguments and we no longer need options.
This enables us to instantiate Test from "plain old data" types. Since
options must be given as arguments, it also makes people think harder
about adding things that may not belong in Test. This will help ensure a
proper separation of responsibility going forward.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 22 Apr 2014 12:20:10 -0700 |
parents | af7d3a5c330b |
children | fa6ba4372678 |
comparison
equal
deleted
inserted
replaced
21517:af7d3a5c330b | 21518:8e8049b9bda4 |
---|---|
336 """ | 336 """ |
337 | 337 |
338 # Status code reserved for skipped tests (used by hghave). | 338 # Status code reserved for skipped tests (used by hghave). |
339 SKIPPED_STATUS = 80 | 339 SKIPPED_STATUS = 80 |
340 | 340 |
341 def __init__(self, options, path, tmpdir, abort, keeptmpdir=False, | 341 def __init__(self, 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'], extraconfigopts=None, | 344 startport=defaults['port'], extraconfigopts=None, |
345 py3kwarnings=False, shell=None): | 345 py3kwarnings=False, shell=None): |
346 """Create a test from parameters. | 346 """Create a test from parameters. |
347 | 347 |
348 options are parsed command line options that control test execution. | |
349 | |
350 path is the full path to the file defining the test. | 348 path is the full path to the file defining the test. |
351 | 349 |
352 tmpdir is the main temporary directory to use for this test. | 350 tmpdir is the main temporary directory to use for this test. |
353 | 351 |
354 abort is a flag that turns to True if test execution should be aborted. | 352 abort is a flag that turns to True if test execution should be aborted. |
387 self.path = path | 385 self.path = path |
388 self.name = os.path.basename(path) | 386 self.name = os.path.basename(path) |
389 self._testdir = os.path.dirname(path) | 387 self._testdir = os.path.dirname(path) |
390 self.errpath = os.path.join(self._testdir, '%s.err' % self.name) | 388 self.errpath = os.path.join(self._testdir, '%s.err' % self.name) |
391 | 389 |
392 self._options = options | |
393 self._threadtmp = tmpdir | 390 self._threadtmp = tmpdir |
394 self._abort = abort | 391 self._abort = abort |
395 self._keeptmpdir = keeptmpdir | 392 self._keeptmpdir = keeptmpdir |
396 self._debug = debug | 393 self._debug = debug |
397 self._nodiff = nodiff | 394 self._nodiff = nodiff |
1519 break | 1516 break |
1520 | 1517 |
1521 refpath = os.path.join(self.testdir, test) | 1518 refpath = os.path.join(self.testdir, test) |
1522 tmpdir = os.path.join(self.hgtmp, 'child%d' % count) | 1519 tmpdir = os.path.join(self.hgtmp, 'child%d' % count) |
1523 | 1520 |
1524 return testcls(self.options, refpath, tmpdir, self.abort, | 1521 return testcls(refpath, tmpdir, self.abort, |
1525 keeptmpdir=self.options.keep_tmpdir, | 1522 keeptmpdir=self.options.keep_tmpdir, |
1526 debug=self.options.debug, | 1523 debug=self.options.debug, |
1527 nodiff = self.options.nodiff, | 1524 nodiff = self.options.nodiff, |
1528 diffviewer=self.options.view, | 1525 diffviewer=self.options.view, |
1529 interactive=self.options.interactive, | 1526 interactive=self.options.interactive, |