From: Brian Warner Date: Tue, 24 Apr 2007 04:15:02 +0000 (-0700) Subject: testutil: make SignalMixin actually be a mixin (and not inherit from TestCase), use... X-Git-Url: https://git.rkrishnan.org/pf/content/COPYING.TGPPL.html?a=commitdiff_plain;h=8307aaccb6b351813f4bcadfe3b940f229c32087;p=tahoe-lafs%2Ftahoe-lafs.git testutil: make SignalMixin actually be a mixin (and not inherit from TestCase), use it from all tests that start notes and thus exec ifconfig --- diff --git a/src/allmydata/test/test_iputil.py b/src/allmydata/test/test_iputil.py index a2ffe08d..3a06b4cd 100644 --- a/src/allmydata/test/test_iputil.py +++ b/src/allmydata/test/test_iputil.py @@ -1,12 +1,12 @@ -from allmydata.util import iputil +from allmydata.util import iputil, testutil from twisted.trial import unittest import re DOTTED_QUAD_RE=re.compile("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$") -class ListAddresses(unittest.TestCase): +class ListAddresses(testutil.SignalMixin, unittest.TestCase): def test_get_local_ip_for(self): addr = iputil.get_local_ip_for('127.0.0.1') self.failUnless(DOTTED_QUAD_RE.match(addr)) diff --git a/src/allmydata/test/test_queen.py b/src/allmydata/test/test_queen.py index e60d4334..2f79bb81 100644 --- a/src/allmydata/test/test_queen.py +++ b/src/allmydata/test/test_queen.py @@ -3,8 +3,9 @@ from twisted.trial import unittest from foolscap.eventual import flushEventualQueue from allmydata import queen +from allmydata.util import testutil -class Basic(unittest.TestCase): +class Basic(testutil.SignalMixin, unittest.TestCase): def test_loadable(self): q = queen.Queen() d = q.startService() diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 00e903f2..a79202eb 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -4,7 +4,7 @@ from twisted.trial import unittest from twisted.internet import defer, reactor from twisted.application import service from allmydata import client, queen, uri, download -from allmydata.util import idlib, fileutil +from allmydata.util import idlib, fileutil, testutil from foolscap.eventual import flushEventualQueue from twisted.python import log from twisted.python.failure import Failure @@ -17,7 +17,7 @@ def flush_but_dont_ignore(res): d.addCallback(_done) return d -class SystemTest(unittest.TestCase): +class SystemTest(testutil.SignalMixin, unittest.TestCase): def setUp(self): self.sparent = service.MultiService() diff --git a/src/allmydata/util/testutil.py b/src/allmydata/util/testutil.py index fb6dc760..b742855a 100644 --- a/src/allmydata/util/testutil.py +++ b/src/allmydata/util/testutil.py @@ -3,7 +3,7 @@ import os, signal, sys, time from twisted.internet import reactor from twisted.trial import unittest -class SignalMixin(unittest.TestCase): +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