Package buildbot :: Package monkeypatches :: Module testcase_patch
[frames] | no frames]

Source Code for Module buildbot.monkeypatches.testcase_patch

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Copyright Buildbot Team Members 
15   
16  import sys 
17  import twisted 
18  from twisted.trial import unittest 
19   
20 -def patch_testcase_patch():
21 """ 22 Patch out TestCase.patch to skip the test on version combinations where it 23 does not work. 24 25 (used for debugging only) 26 """ 27 # versions of Twisted before 9.0.0 did not have a UnitTest.patch that 28 # worked on Python-2.7 29 if twisted.version.major <= 9 and sys.version_info[:2] == (2,7): 30 def nopatch(self, *args): 31 raise unittest.SkipTest('unittest.TestCase.patch is not available')
32 unittest.TestCase.patch = nopatch 33