Changeset bbd3b200 in trunk


Ignore:
Timestamp:
2019-03-07T23:38:52Z (6 years ago)
Author:
Jean-Paul Calderone <exarkun@…>
Branches:
master
Children:
154f9dc8
Parents:
565616d
git-author:
Jean-Paul Calderone <exarkun@…> (2019-03-07 20:04:53)
git-committer:
Jean-Paul Calderone <exarkun@…> (2019-03-07 23:38:52)
Message:

Use our base TestCase? classes for these introducer tests

They gain free tempfile cleanup as a result.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/test/test_introducer.py

    r565616d rbbd3b200  
    55from socket import socket, AF_INET
    66from mock import Mock, patch
     7
     8from testtools.matchers import (
     9    Is,
     10)
    711
    812from twisted.trial import unittest
     
    3539from allmydata.util import pollmixin, keyutil, idlib, fileutil, iputil, yamlutil
    3640import allmydata.test.common_util as testutil
     41from .common import (
     42    AsyncTestCase,
     43    SyncTestCase,
     44)
    3745
    3846fcntl = requireModule("fcntl")
     
    4250        log.msg(msg, **kw)
    4351
    44 class Node(testutil.SignalMixin, testutil.ReallyEqualMixin, unittest.TestCase):
     52class Node(testutil.SignalMixin, testutil.ReallyEqualMixin, AsyncTestCase):
    4553
    4654    def test_backwards_compat_import(self):
     
    144152        return d
    145153
    146 class Introducer(ServiceMixin, unittest.TestCase, pollmixin.PollMixin):
     154class Introducer(ServiceMixin, AsyncTestCase, pollmixin.PollMixin):
    147155    def test_create(self):
    148156        ic = IntroducerClient(None, "introducer.furl", u"my_nickname",
     
    176184    return ann_t
    177185
    178 class Client(unittest.TestCase):
     186class Client(AsyncTestCase):
    179187    def test_duplicate_receive_v2(self):
    180188        ic1 = IntroducerClient(None,
     
    285293        return d
    286294
    287 class Server(unittest.TestCase):
     295class Server(AsyncTestCase):
    288296    def test_duplicate(self):
    289297        i = IntroducerService()
     
    435443        self.central_portnum = listenOnUnused(tub, portnum)
    436444
    437 class Queue(SystemTestMixin, unittest.TestCase):
     445class Queue(SystemTestMixin, AsyncTestCase):
    438446    def test_queue_until_connected(self):
    439447        self.basedir = "introducer/QueueUntilConnected/queued"
     
    485493
    486494
    487 class SystemTest(SystemTestMixin, unittest.TestCase):
     495class SystemTest(SystemTestMixin, AsyncTestCase):
    488496
    489497    def do_system_test(self):
     
    780788                                                  3456)
    781789
    782 class ClientInfo(unittest.TestCase):
     790class ClientInfo(AsyncTestCase):
    783791    def test_client_v2(self):
    784792        introducer = IntroducerService()
     
    802810        self.failUnlessEqual(s0.version, "my_version")
    803811
    804 class Announcements(unittest.TestCase):
     812class Announcements(AsyncTestCase):
    805813    def test_client_v2_signed(self):
    806814        introducer = IntroducerService()
     
    819827        a = introducer.get_announcements()
    820828        self.failUnlessEqual(len(a), 1)
    821         self.failUnlessIdentical(a[0].canary, canary0)
     829        self.assertThat(a[0].canary, Is(canary0))
    822830        self.failUnlessEqual(a[0].index, ("storage", pks))
    823831        self.failUnlessEqual(a[0].announcement["app-versions"], app_versions)
     
    923931                         frozenset([pub1, pub2]))
    924932
    925 class ClientSeqnums(unittest.TestCase):
     933class ClientSeqnums(AsyncTestCase):
    926934
    927935    @defer.inlineCallbacks
     
    984992                }
    985993
    986 class NonV1Server(SystemTestMixin, unittest.TestCase):
     994class NonV1Server(SystemTestMixin, AsyncTestCase):
    987995    # if the client connects to a server that doesn't provide the 'v2'
    988996    # protocol, it is supposed to provide a useful error instead of a weird
     
    10231031        return d
    10241032
    1025 class DecodeFurl(unittest.TestCase):
     1033class DecodeFurl(SyncTestCase):
    10261034    def test_decode(self):
    10271035        # make sure we have a working base64.b32decode. The one in
     
    10331041        self.failUnlessEqual(nodeid, "\x9fM\xf2\x19\xcckU0\xbf\x03\r\x10\x99\xfb&\x9b-\xc7A\x1d")
    10341042
    1035 class Signatures(unittest.TestCase):
     1043class Signatures(SyncTestCase):
    10361044    def test_sign(self):
    10371045        ann = {"key1": "value1"}
Note: See TracChangeset for help on using the changeset viewer.