diff options
author | James J Lee <jjl@pobox.com> | 2008-03-11 00:31:27 +0000 |
---|---|---|
committer | James J Lee <jjl@pobox.com> | 2008-03-11 00:31:27 +0000 |
commit | 8f1d8e9c626956cca7aea4a0b2fcb6201de3e009 (patch) | |
tree | fb9f0e48f64a71203d16b5906c6460bac0ad6628 | |
parent | 3ce817b56c4b87d58ab66066a07dbdd4cf5d79a3 (diff) | |
download | nose-8f1d8e9c626956cca7aea4a0b2fcb6201de3e009.tar.gz |
Fixed #159. Correct bad ErrorClass exception detail
-rw-r--r-- | nose/plugins/errorclass.py | 10 | ||||
-rw-r--r-- | unit_tests/test_issue_159.rst | 6 |
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 |