[tor-commits] [stem/master] Missing bytes conversion for test data

atagar at torproject.org atagar at torproject.org
Sat Apr 11 21:14:33 UTC 2015


commit f5ec8919847aa1e9d32ceda97e8acaf77a579839
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Apr 11 14:14:42 2015 -0700

    Missing bytes conversion for test data
    
    ======================================================================
    ERROR: test_event_handling
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/atagar/Desktop/stem/test/runner.py", line 127, in wrapped
        return func(self, *args, **kwargs)
      File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 161, in test_event_handling
        controller.set_conf('NodeFamily', random_fingerprint())
      File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 50, in random_fingerprint
        return hashlib.sha1(str(time.time())).hexdigest().upper()
    TypeError: Unicode-objects must be encoded before hashing
    
    ----------------------------------------------------------------------
---
 test/integ/control/controller.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 5deda2b..2265cb2 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -47,7 +47,7 @@ def random_fingerprint():
   Provides a random 40 character hex string.
   """
 
-  return hashlib.sha1(str(time.time())).hexdigest().upper()
+  return hashlib.sha1(stem.util.str_tools._to_bytes(str(time.time()))).hexdigest().upper()
 
 
 class TestController(unittest.TestCase):





More information about the tor-commits mailing list