Skip to content
Commit 982c36e2 authored by Damian Johnson's avatar Damian Johnson
Browse files

Fix test_router_status_entry for python3

Ick, that took me a while to track down. On python3 unit tests sometimes pass,
and sometimes failed with...

  ======================================================================
  FAIL: test_router_status_entry
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/home/atagar/Desktop/stem/test/unit/descriptor/server_descriptor.py", line 296, in test_router_status_entry
      self.assertEqual('4F0069BF91C04581B7C3CA9272E2D3228D4EA571', desc.digest)
  AssertionError: '4F0069BF91C04581B7C3CA9272E2D3228D4EA571' != 'A863EFE8395C41C880782B89B850D20EDD242BDA'
  - 4F0069BF91C04581B7C3CA9272E2D3228D4EA571
  + A863EFE8395C41C880782B89B850D20EDD242BDA

This non-deterministic behavior was because the server descriptor's attributes
were made from a dictionary, and hence had no defined ordering. With python 2.x
they happened to always keep the same order, but with python3 it varied from
run to run. Using OrderedDicts in this call path to ensure the order is
consistent.
parent 33d41646
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment