testtools-dev team mailing list archive
-
testtools-dev team
-
Mailing list archive
-
Message #00213
[Merge] lp:~gz/testtools/no_super_exceptions_2.4_compat into lp:testtools
Martin [gz] has proposed merging lp:~gz/testtools/no_super_exceptions_2.4_compat into lp:testtools.
Requested reviews:
testtools developers (testtools-dev)
In Python 2.4 exceptions are old-style classes, hence trying to use super gets you "TypeError: super() argument 1 must be type, not classobj". This branch just makes the new Exception subclasses call the parent __init__ directly.
--
https://code.launchpad.net/~gz/testtools/no_super_exceptions_2.4_compat/+merge/39281
Your team testtools developers is requested to review the proposed merge of lp:~gz/testtools/no_super_exceptions_2.4_compat into lp:testtools.
=== modified file 'testtools/_spinner.py'
--- testtools/_spinner.py 2010-10-24 08:41:51 +0000
+++ testtools/_spinner.py 2010-10-25 15:23:40 +0000
@@ -30,7 +30,7 @@
"""Raised when we try to re-enter a function that forbids it."""
def __init__(self, function):
- super(ReentryError, self).__init__(
+ Exception.__init__(self,
"%r in not re-entrant but was called within a call to itself."
% (function,))
@@ -117,7 +117,7 @@
"""Raised when run_in_reactor takes too long to run a function."""
def __init__(self, function, timeout):
- super(TimeoutError, self).__init__(
+ Exception.__init__(self,
"%r took longer than %s seconds" % (function, timeout))
@@ -125,7 +125,7 @@
"""Raised when the reactor has stopped but we don't have any result."""
def __init__(self):
- super(NoResultError, self).__init__(
+ Exception.__init__(self,
"Tried to get test's result from Deferred when no result is "
"available. Probably means we received SIGINT or similar.")
@@ -134,7 +134,7 @@
"""Raised when there's junk in the spinner from a previous run."""
def __init__(self, junk):
- super(StaleJunkError, self).__init__(
+ Exception.__init__(self,
"There was junk in the spinner from a previous run. "
"Use clear_junk() to clear it out: %r" % (junk,))
=== modified file 'testtools/deferredruntest.py'
--- testtools/deferredruntest.py 2010-10-18 12:46:03 +0000
+++ testtools/deferredruntest.py 2010-10-25 15:23:40 +0000
@@ -227,7 +227,7 @@
"""Raised when the reactor has junk in it."""
def __init__(self, junk):
- super(UncleanReactorError, self).__init__(
+ Exception.__init__(self,
"The reactor still thinks it needs to do things. Close all "
"connections, kill all processes and make sure all delayed "
"calls have either fired or been cancelled. The management "
Follow ups