[tor-commits] [stem/master] Python3 compatability for networkstatus unit test

atagar at torproject.org atagar at torproject.org
Wed Jun 21 17:10:44 UTC 2017


commit 657a2b89b65c4b2c468d784e6ae2ac667ba84706
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jun 21 08:43:09 2017 -0700

    Python3 compatability for networkstatus unit test
    
    Trivial fix. Just some missing unicode/bytes normalization.
    
      ======================================================================
      ERROR: test_signature_validation
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/test/require.py", line 58, in wrapped
          return func(self, *args, **kwargs)
        File "/home/atagar/Desktop/stem/test/unit/descriptor/networkstatus/document_v3.py", line 421, in test_signature_validation
          consensus = stem.descriptor.networkstatus.NetworkStatusDocumentV3(consensus_content.replace('test002r', 'different_nickname'))
      TypeError: expected an object with the buffer interface
    
      ----------------------------------------------------------------------
---
 test/unit/descriptor/networkstatus/document_v3.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/unit/descriptor/networkstatus/document_v3.py b/test/unit/descriptor/networkstatus/document_v3.py
index efdf1bb..68d7270 100644
--- a/test/unit/descriptor/networkstatus/document_v3.py
+++ b/test/unit/descriptor/networkstatus/document_v3.py
@@ -418,7 +418,7 @@ DnN5aFtYKiTc19qIC7Nmo+afPdDEf0MlJvEOP5EWl3w=
 
     # change a relay's nickname in the consensus so it's no longer validly signed
 
-    consensus = stem.descriptor.networkstatus.NetworkStatusDocumentV3(consensus_content.replace('test002r', 'different_nickname'))
+    consensus = stem.descriptor.networkstatus.NetworkStatusDocumentV3(consensus_content.replace(b'test002r', b'different_nickname'))
     self.assertRaisesRegexp(ValueError, 'Network Status Document has 0 valid signatures out of 2 total, needed 1', consensus.validate_signatures, certs)
 
   def test_handlers(self):





More information about the tor-commits mailing list