summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames J Lee <jjl@pobox.com>2008-03-11 00:31:27 +0000
committerJames J Lee <jjl@pobox.com>2008-03-11 00:31:27 +0000
commit8f1d8e9c626956cca7aea4a0b2fcb6201de3e009 (patch)
treefb9f0e48f64a71203d16b5906c6460bac0ad6628
parent3ce817b56c4b87d58ab66066a07dbdd4cf5d79a3 (diff)
downloadnose-8f1d8e9c626956cca7aea4a0b2fcb6201de3e009.tar.gz
Fixed #159. Correct bad ErrorClass exception detail
-rw-r--r--nose/plugins/errorclass.py10
-rw-r--r--unit_tests/test_issue_159.rst6
2 files changed, 11 insertions, 5 deletions
diff --git a/nose/plugins/errorclass.py b/nose/plugins/errorclass.py
index 6d95203..b06e014 100644
--- a/nose/plugins/errorclass.py
+++ b/nose/plugins/errorclass.py
@@ -111,11 +111,11 @@ class ErrorClass(object):
def __init__(self, *errorClasses, **kw):
self.errorClasses = errorClasses
try:
- self.label = kw.pop('label')
- self.isfailure = kw.pop('isfailure')
- except KeyError, e:
- raise TypeError("%s is a required named argument for ErrorClass"
- % e)
+ for key in ('label', 'isfailure'):
+ setattr(self, key, kw.pop(key))
+ except KeyError:
+ raise TypeError("%r is a required named argument for ErrorClass"
+ % key)
def __iter__(self):
return iter(self.errorClasses)
diff --git a/unit_tests/test_issue_159.rst b/unit_tests/test_issue_159.rst
new file mode 100644
index 0000000..5ab7964
--- /dev/null
+++ b/unit_tests/test_issue_159.rst
@@ -0,0 +1,6 @@
+ >>> from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
+ >>> class X(Exception):
+ ... pass
+ >>> xes = ErrorClass(X, label='XXX')
+ Traceback (most recent call last):
+ TypeError: 'isfailure' is a required named argument for ErrorClass