Mercurial > hg
comparison tests/basic_test_result.py @ 38621:f4a214300957
run-tests: add missing life-cycle methods on the example custom test result
A previous commit introduced `onStart` and `onEnd` methods on test result but
the one used in tests lacked those two methods. Fix it and add some output to
be sure they are called.
Differential Revision: https://phab.mercurial-scm.org/D3899
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 10 Jul 2018 08:25:04 +0200 |
parents | c44ae5997869 |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
38620:875e033fbbdd | 38621:f4a214300957 |
---|---|
1 from __future__ import print_function | 1 from __future__ import absolute_import, print_function |
2 | 2 |
3 import unittest | 3 import unittest |
4 | 4 |
5 class TestResult(unittest._TextTestResult): | 5 class TestResult(unittest._TextTestResult): |
6 | 6 |
37 print("SKIP!", test, reason) | 37 print("SKIP!", test, reason) |
38 | 38 |
39 def addIgnore(self, test, reason): | 39 def addIgnore(self, test, reason): |
40 print("IGNORE!", test, reason) | 40 print("IGNORE!", test, reason) |
41 | 41 |
42 def onStart(self, test): | |
43 print("ON_START!", test) | |
44 | |
45 def onEnd(self): | |
46 print("ON_END!") | |
47 | |
42 def addOutputMismatch(self, test, ret, got, expected): | 48 def addOutputMismatch(self, test, ret, got, expected): |
43 return False | 49 return False |
44 | 50 |
45 def stopTest(self, test, interrupted=False): | 51 def stopTest(self, test, interrupted=False): |
46 super(TestResult, self).stopTest(test) | 52 super(TestResult, self).stopTest(test) |