Skip to content

Commit

Permalink
UnitTest patching does not work with Twisted <= 9.0.0 and Python-2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin J. Mitchell committed Aug 25, 2010
1 parent 062aa53 commit 9003e71
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions slave/buildslave/test/__init__.py
Expand Up @@ -22,11 +22,11 @@ def stopService(self):
Service.startService = startService
Service.stopService = stopService

# make unittest.TestCase have a patch method, even if it just skips
# the test.
def nopatch(self, *args):
raise unittest.SkipTest('unittest.patch is not available')
if not hasattr(unittest.TestCase, 'patch'):
# versions of Twisted before 9.0.0 did not have a UnitTest.patch that worked
# on Python-2.7
if twisted.version.major <= 9 and sys.version_info[:2] == (2,7):
def nopatch(self, *args):
raise unittest.SkipTest('unittest.patch is not available')
unittest.TestCase.patch = nopatch

add_debugging_monkeypatches()
Expand Down

0 comments on commit 9003e71

Please sign in to comment.