Mercurial > hg
comparison tests/run-tests.py @ 32942:5af78c524f34
tests: remove support for warned tests
The previous changeset removed the last caller of addWarn(). So,
we rip out that method and all the code related to tracking warned
tests in the results system.
There was even a comment saying we may want to fold warned tests into
the "failed" state, which is what the previous changeset did.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 03 Jun 2017 17:22:45 -0700 |
parents | 6123a5267119 |
children | 750c3b1bb8a3 |
comparison
equal
deleted
inserted
replaced
32941:20ed0e6a4905 | 32942:5af78c524f34 |
---|---|
1498 # We have a custom "ignored" result that isn't present in any Python | 1498 # We have a custom "ignored" result that isn't present in any Python |
1499 # unittest implementation. It is very similar to skipped. It may make | 1499 # unittest implementation. It is very similar to skipped. It may make |
1500 # sense to map it into skip some day. | 1500 # sense to map it into skip some day. |
1501 self.ignored = [] | 1501 self.ignored = [] |
1502 | 1502 |
1503 # We have a custom "warned" result that isn't present in any Python | |
1504 # unittest implementation. It is very similar to failed. It may make | |
1505 # sense to map it into fail some day. | |
1506 self.warned = [] | |
1507 | |
1508 self.times = [] | 1503 self.times = [] |
1509 self._firststarttime = None | 1504 self._firststarttime = None |
1510 # Data stored for the benefit of generating xunit reports. | 1505 # Data stored for the benefit of generating xunit reports. |
1511 self.successes = [] | 1506 self.successes = [] |
1512 self.faildata = {} | 1507 self.faildata = {} |
1555 else: | 1550 else: |
1556 if reason not in ('not retesting', "doesn't match keyword"): | 1551 if reason not in ('not retesting', "doesn't match keyword"): |
1557 self.stream.write('i') | 1552 self.stream.write('i') |
1558 else: | 1553 else: |
1559 self.testsRun += 1 | 1554 self.testsRun += 1 |
1560 self.stream.flush() | |
1561 | |
1562 def addWarn(self, test, reason): | |
1563 self.warned.append((test, reason)) | |
1564 | |
1565 if self._options.first: | |
1566 self.stop() | |
1567 | |
1568 with iolock: | |
1569 if self.showAll: | |
1570 self.stream.writeln('warned %s' % reason) | |
1571 else: | |
1572 self.stream.write('~') | |
1573 self.stream.flush() | 1555 self.stream.flush() |
1574 | 1556 |
1575 def addOutputMismatch(self, test, ret, got, expected): | 1557 def addOutputMismatch(self, test, ret, got, expected): |
1576 """Record a mismatch in test output for a particular test.""" | 1558 """Record a mismatch in test output for a particular test.""" |
1577 if self.shouldStop: | 1559 if self.shouldStop: |
1920 self.descriptions, self.verbosity) | 1902 self.descriptions, self.verbosity) |
1921 | 1903 |
1922 test(result) | 1904 test(result) |
1923 | 1905 |
1924 failed = len(result.failures) | 1906 failed = len(result.failures) |
1925 warned = len(result.warned) | |
1926 skipped = len(result.skipped) | 1907 skipped = len(result.skipped) |
1927 ignored = len(result.ignored) | 1908 ignored = len(result.ignored) |
1928 | 1909 |
1929 with iolock: | 1910 with iolock: |
1930 self.stream.writeln('') | 1911 self.stream.writeln('') |
1931 | 1912 |
1932 if not self._runner.options.noskips: | 1913 if not self._runner.options.noskips: |
1933 for test, msg in result.skipped: | 1914 for test, msg in result.skipped: |
1934 self.stream.writeln('Skipped %s: %s' % (test.name, msg)) | 1915 self.stream.writeln('Skipped %s: %s' % (test.name, msg)) |
1935 for test, msg in result.warned: | |
1936 self.stream.writeln('Warned %s: %s' % (test.name, msg)) | |
1937 for test, msg in result.failures: | 1916 for test, msg in result.failures: |
1938 self.stream.writeln('Failed %s: %s' % (test.name, msg)) | 1917 self.stream.writeln('Failed %s: %s' % (test.name, msg)) |
1939 for test, msg in result.errors: | 1918 for test, msg in result.errors: |
1940 self.stream.writeln('Errored %s: %s' % (test.name, msg)) | 1919 self.stream.writeln('Errored %s: %s' % (test.name, msg)) |
1941 | 1920 |
1984 verb = 'broken' if dat['goodbad'] == 'bad' else 'fixed' | 1963 verb = 'broken' if dat['goodbad'] == 'bad' else 'fixed' |
1985 self.stream.writeln( | 1964 self.stream.writeln( |
1986 '%s %s by %s (%s)' % ( | 1965 '%s %s by %s (%s)' % ( |
1987 test, verb, dat['node'], dat['summary'])) | 1966 test, verb, dat['node'], dat['summary'])) |
1988 self.stream.writeln( | 1967 self.stream.writeln( |
1989 '# Ran %d tests, %d skipped, %d warned, %d failed.' | 1968 '# Ran %d tests, %d skipped, %d failed.' |
1990 % (result.testsRun, | 1969 % (result.testsRun, skipped + ignored, failed)) |
1991 skipped + ignored, warned, failed)) | |
1992 if failed: | 1970 if failed: |
1993 self.stream.writeln('python hash seed: %s' % | 1971 self.stream.writeln('python hash seed: %s' % |
1994 os.environ['PYTHONHASHSEED']) | 1972 os.environ['PYTHONHASHSEED']) |
1995 if self._runner.options.time: | 1973 if self._runner.options.time: |
1996 self.printtimes(result.times) | 1974 self.printtimes(result.times) |
2400 testdescs = orig | 2378 testdescs = orig |
2401 | 2379 |
2402 tests = [self._gettest(d, i) for i, d in enumerate(testdescs)] | 2380 tests = [self._gettest(d, i) for i, d in enumerate(testdescs)] |
2403 | 2381 |
2404 failed = False | 2382 failed = False |
2405 warned = False | |
2406 kws = self.options.keywords | 2383 kws = self.options.keywords |
2407 if kws is not None and PYTHON3: | 2384 if kws is not None and PYTHON3: |
2408 kws = kws.encode('utf-8') | 2385 kws = kws.encode('utf-8') |
2409 | 2386 |
2410 suite = TestSuite(self._testdir, | 2387 suite = TestSuite(self._testdir, |
2436 | 2413 |
2437 result = runner.run(suite) | 2414 result = runner.run(suite) |
2438 | 2415 |
2439 if result.failures: | 2416 if result.failures: |
2440 failed = True | 2417 failed = True |
2441 if result.warned: | |
2442 warned = True | |
2443 | 2418 |
2444 if self.options.anycoverage: | 2419 if self.options.anycoverage: |
2445 self._outputcoverage() | 2420 self._outputcoverage() |
2446 except KeyboardInterrupt: | 2421 except KeyboardInterrupt: |
2447 failed = True | 2422 failed = True |
2448 print("\ninterrupted!") | 2423 print("\ninterrupted!") |
2449 | 2424 |
2450 if failed: | 2425 if failed: |
2451 return 1 | 2426 return 1 |
2452 if warned: | |
2453 return 80 | |
2454 | 2427 |
2455 def _getport(self, count): | 2428 def _getport(self, count): |
2456 port = self._ports.get(count) # do we have a cached entry? | 2429 port = self._ports.get(count) # do we have a cached entry? |
2457 if port is None: | 2430 if port is None: |
2458 portneeded = 3 | 2431 portneeded = 3 |