
Aug. 27, 2017
2:03 a.m.
On Sun, Aug 27, 2017 at 4:25 AM, francismb <francismb@email.de> wrote:
Hi all, while using `unittest` I see the pattern of creating an error message with the test context for the case that some `assert...` methods fails (to get a good error message). On the lines:
class Test...(unittest.TestCase):
longMessage = True
def test_(self): ... for a, b, c ... in zip(A, B, C, ..): * call the function under test and get the result msg = "Some headline: {}{} ...".format(a, b, c,..) self.assert...( ,msg)
The `msg` is just used in case the assert fails but its creation takes time and adds up.
Have you measured it, eg by replacing the message with a constant? By what percentage does it speed up a successful test run? ChrisA