1 from twisted.trial import unittest
2
4 """
5 DO NOT CALL THIS DIRECTLY
6
7 This adds a few "harmless" monkeypatches which make it easier to debug
8 failing tests. It is called automatically by buildbot.test.__init__.
9 """
10 from twisted.application.service import Service
11 old_startService = Service.startService
12 old_stopService = Service.stopService
13 def startService(self):
14 assert not self.running
15 return old_startService(self)
16 def stopService(self):
17 assert self.running
18 return old_stopService(self)
19 Service.startService = startService
20 Service.stopService = stopService
21
22
23
24 def nopatch(self, *args):
25 raise unittest.SkipTest('unittest.patch is not available')
26 if not hasattr(unittest.TestCase, 'patch'):
27 unittest.TestCase.patch = nopatch
28