class SignalMixin:
# This class is necessary for any code which wants to use Processes
# outside the usual reactor.run() environment. It is copied from
- # Twisted's twisted.test.test_process
+ # Twisted's twisted.test.test_process . Note that Twisted-8.2.0 uses
+ # something rather different.
sigchldHandler = None
- def setUpClass(self):
+ def setUp(self):
# make sure SIGCHLD handler is installed, as it should be on
# reactor.run(). problem is reactor may not have been run when this
# test runs.
self.sigchldHandler = signal.signal(signal.SIGCHLD,
reactor._handleSigchld)
- def tearDownClass(self):
+ def tearDown(self):
if self.sigchldHandler:
signal.signal(signal.SIGCHLD, self.sigchldHandler)
to without access to real randomness and real time.time from the
code under test
"""
+ SignalMixin.setUp(self)
self.repeatable = repeatable
if self.repeatable:
import repeatable_random
self.teststarttime = time.time()
def tearDown(self):
+ SignalMixin.tearDown(self)
if self.repeatable:
import repeatable_random
repeatable_random.restore_non_repeatability()
CERTFILE='DEFAULT_CERTFILE_BLANK'
PORTNUMFILE='DEFAULT_PORTNUMFILE_BLANK'
-class TestCase(unittest.TestCase, testutil.SignalMixin):
+class TestCase(testutil.SignalMixin, unittest.TestCase):
def setUp(self):
+ testutil.SignalMixin.setUp(self)
self.parent = LoggingMultiService()
self.parent.startService()
def tearDown(self):
log.msg("%s.tearDown" % self.__class__.__name__)
+ testutil.SignalMixin.tearDown(self)
d = defer.succeed(None)
d.addCallback(lambda res: self.parent.stopService())
d.addCallback(flushEventualQueue)
if "cygwin" in sys.platform.lower():
raise unittest.SkipTest("We don't know how to make this test work on cygwin: spawnProcess seems to hang forever. We don't know if 'bin/tahoe start' can be run on cygwin.")
-class TheRightCode(unittest.TestCase, common_util.SignalMixin,
+class TheRightCode(common_util.SignalMixin, unittest.TestCase,
SkipOnCygwinMixin):
def test_path(self):
self.skip_on_cygwin()
run_by_human=False)
-class RunNode(unittest.TestCase, pollmixin.PollMixin, common_util.SignalMixin,
+class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin,
SkipOnCygwinMixin):
# exercise "tahoe start", for both introducer, client node, and
# key-generator, by spawning "tahoe start" as a subprocess. This doesn't