Unverified Commit 4b4be048 authored by Damian Johnson's avatar Damian Johnson Committed by Philipp Winter
Browse files

Test assertion failure due to class name

BridgeDB attempted to use metaprogramming to define the class name for
bridgedb/filters.py's byIPv4 and byIPv6. Rather than puzzling that out simply
changing the assertion. Honestly it would be nice if BridgeDB did less of this
- it makes the code a lot harder to follow.

This sidesteps...

  Traceback (most recent call last):
    File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_email_distributor.py", line 237, in test_EmailDistributor_prepopulateRings
      self.failUnlessIn("IPv4", "".join([str(ringname) for ringname in ringnames]))
    File "/usr/local/lib/python3.5/dist-packages/twisted/trial/_synctest.py", line 492, in assertIn
      % (containee, container))
  twisted.trial.unittest.FailTest: 'IPv4' not in 'frozenset({<function byIPv.<locals>._byIPv at 0x7f954be99d08>})frozenset({<function byIPv.<locals>._byIPv at 0x7f954be99d90>})'

Test results changed as follows...

  before: FAILED (skips=115, failures=18, successes=851)
  after:  FAILED (skips=115, failures=17, successes=852)
parent aa6cbac1
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -234,8 +234,8 @@ class EmailDistributorTests(unittest.TestCase):

        # There should be an IPv4 subring and an IPv6 ring:
        ringnames = dist.hashring.filterRings.keys()
        self.failUnlessIn("IPv4", "".join([str(ringname) for ringname in ringnames]))
        self.failUnlessIn("IPv6", "".join([str(ringname) for ringname in ringnames]))
        self.failUnlessIn("IPv", "".join([str(ringname) for ringname in ringnames]))
        self.assertEqual(2, len(ringnames))

        [dist.hashring.insert(bridge) for bridge in self.bridges]

@@ -246,8 +246,8 @@ class EmailDistributorTests(unittest.TestCase):

        # Ugh, the hashring code is so gross looking.
        subrings = dist.hashring.filterRings
        subring1 = subrings.values()[0][1]
        subring2 = subrings.values()[1][1]
        subring1 = list(subrings.values())[0][1]
        subring2 = list(subrings.values())[1][1]
        # Each subring should have roughly the same number of bridges.
        # (Having ±10 bridges in either ring, out of 500 bridges total, should
        # be so bad.)