From 52746e85048e49fc3645fd303b6be0be2b0e650d Mon Sep 17 00:00:00 2001 From: Renato Alves Date: Thu, 23 Jul 2015 17:42:41 +0100 Subject: [PATCH] TAP: Don't fail on errors during setUpClass --- test/simpletap/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/simpletap/__init__.py b/test/simpletap/__init__.py index 8792c6c74..17aeee95e 100644 --- a/test/simpletap/__init__.py +++ b/test/simpletap/__init__.py @@ -66,7 +66,12 @@ class TAPTestResult(unittest.result.TestResult): if self.descriptions and doc_first_line: return doc_first_line else: - return "{0} ({1})".format(test._testMethodName, test.__class__.__name__) + try: + method = test._testMethodName + except AttributeError: + return "Preparation error on: {0}".format(test.description) + else: + return "{0} ({1})".format(method, test.__class__.__name__) def startTestRun(self, total="unk"): self.stream.writeln("1..{0}".format(total))