From 296645638772c17271c2e6724b5fa782ba62f8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 10 Feb 2016 17:06:45 +0100 Subject: [PATCH] tests: improve assertNotRaises reporting Include whole exception value, not only its type. --- qubes/tests/__init__.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/qubes/tests/__init__.py b/qubes/tests/__init__.py index 4f941c78..21e216dd 100644 --- a/qubes/tests/__init__.py +++ b/qubes/tests/__init__.py @@ -147,14 +147,9 @@ class _AssertNotRaisesContext(object): if exc_type is None: return True - try: - exc_name = self.expected.__name__ - except AttributeError: - exc_name = str(self.expected) - if issubclass(exc_type, self.expected): raise self.failureException( - "{0} raised".format(exc_name)) + "{!r} raised".format(exc_value)) else: # pass through return False