Show More
@@ -338,7 +338,7 b' class Test(unittest.TestCase):' | |||||
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, runner, test, count |
|
341 | def __init__(self, runner, test, count): | |
342 | path = os.path.join(runner.testdir, test) |
|
342 | path = os.path.join(runner.testdir, test) | |
343 | errpath = os.path.join(runner.testdir, '%s.err' % test) |
|
343 | errpath = os.path.join(runner.testdir, '%s.err' % test) | |
344 |
|
344 | |||
@@ -350,7 +350,6 b' class Test(unittest.TestCase):' | |||||
350 | self._options = runner.options |
|
350 | self._options = runner.options | |
351 | self._count = count |
|
351 | self._count = count | |
352 | self._daemonpids = [] |
|
352 | self._daemonpids = [] | |
353 | self._refpath = refpath |
|
|||
354 | self._errpath = errpath |
|
353 | self._errpath = errpath | |
355 |
|
354 | |||
356 | self._finished = None |
|
355 | self._finished = None | |
@@ -363,8 +362,8 b' class Test(unittest.TestCase):' | |||||
363 | # check test output against it. |
|
362 | # check test output against it. | |
364 | if runner.options.debug: |
|
363 | if runner.options.debug: | |
365 | self._refout = None # to match "out is None" |
|
364 | self._refout = None # to match "out is None" | |
366 | elif os.path.exists(refpath): |
|
365 | elif os.path.exists(self._refpath): | |
367 | f = open(refpath, 'r') |
|
366 | f = open(self._refpath, 'r') | |
368 | self._refout = f.read().splitlines(True) |
|
367 | self._refout = f.read().splitlines(True) | |
369 | f.close() |
|
368 | f.close() | |
370 | else: |
|
369 | else: | |
@@ -667,6 +666,11 b' class Test(unittest.TestCase):' | |||||
667 |
|
666 | |||
668 | class PythonTest(Test): |
|
667 | class PythonTest(Test): | |
669 | """A Python-based test.""" |
|
668 | """A Python-based test.""" | |
|
669 | ||||
|
670 | @property | |||
|
671 | def _refpath(self): | |||
|
672 | return os.path.join(self._testdir, '%s.out' % self.name) | |||
|
673 | ||||
670 | def _run(self, replacements, env): |
|
674 | def _run(self, replacements, env): | |
671 | py3kswitch = self._options.py3k_warnings and ' -3' or '' |
|
675 | py3kswitch = self._options.py3k_warnings and ' -3' or '' | |
672 | cmd = '%s%s "%s"' % (PYTHON, py3kswitch, self._path) |
|
676 | cmd = '%s%s "%s"' % (PYTHON, py3kswitch, self._path) | |
@@ -687,6 +691,10 b' class TTest(Test):' | |||||
687 | ESCAPEMAP = dict((chr(i), r'\x%02x' % i) for i in range(256)).update( |
|
691 | ESCAPEMAP = dict((chr(i), r'\x%02x' % i) for i in range(256)).update( | |
688 | {'\\': '\\\\', '\r': r'\r'}) |
|
692 | {'\\': '\\\\', '\r': r'\r'}) | |
689 |
|
693 | |||
|
694 | @property | |||
|
695 | def _refpath(self): | |||
|
696 | return os.path.join(self._testdir, self.name) | |||
|
697 | ||||
690 | def _run(self, replacements, env): |
|
698 | def _run(self, replacements, env): | |
691 | f = open(self._path) |
|
699 | f = open(self._path) | |
692 | lines = f.readlines() |
|
700 | lines = f.readlines() | |
@@ -1240,8 +1248,8 b' class TestRunner(object):' | |||||
1240 | ] |
|
1248 | ] | |
1241 |
|
1249 | |||
1242 | TESTTYPES = [ |
|
1250 | TESTTYPES = [ | |
1243 |
('.py', PythonTest |
|
1251 | ('.py', PythonTest), | |
1244 |
('.t', TTest |
|
1252 | ('.t', TTest), | |
1245 | ] |
|
1253 | ] | |
1246 |
|
1254 | |||
1247 | def __init__(self): |
|
1255 | def __init__(self): | |
@@ -1446,17 +1454,14 b' class TestRunner(object):' | |||||
1446 | map to a known type. |
|
1454 | map to a known type. | |
1447 | """ |
|
1455 | """ | |
1448 | lctest = test.lower() |
|
1456 | lctest = test.lower() | |
1449 | refpath = os.path.join(self.testdir, test) |
|
|||
1450 |
|
||||
1451 | testcls = Test |
|
1457 | testcls = Test | |
1452 |
|
1458 | |||
1453 |
for ext, cls |
|
1459 | for ext, cls in self.TESTTYPES: | |
1454 | if lctest.endswith(ext): |
|
1460 | if lctest.endswith(ext): | |
1455 | testcls = cls |
|
1461 | testcls = cls | |
1456 | refpath = os.path.join(self.testdir, test + out) |
|
|||
1457 | break |
|
1462 | break | |
1458 |
|
1463 | |||
1459 |
return testcls(self, test, count |
|
1464 | return testcls(self, test, count) | |
1460 |
|
1465 | |||
1461 | def _cleanup(self): |
|
1466 | def _cleanup(self): | |
1462 | """Clean up state from this test invocation.""" |
|
1467 | """Clean up state from this test invocation.""" |
General Comments 0
You need to be logged in to leave comments.
Login now