[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Proc unit testing failure under python3



commit 9e0369d68547ec8f128a7472be0ddc8bbe0d3e93
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Feb 2 07:59:52 2016 -0800

    Proc unit testing failure under python3
    
    Simple bytes/unicode error in our tests. This caused a couple proc tests to
    fail under python3...
    
      ======================================================================
      ERROR: test_connections_ipv6
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/stem/util/proc.py", line 370, in connections
          with open(proc_file_path, 'rb') as proc_file:
        File "/usr/local/lib/python3.2/dist-packages/mock/mock.py", line 1062, in __call__
          return _mock_self._mock_call(*args, **kwargs)
        File "/usr/local/lib/python3.2/dist-packages/mock/mock.py", line 1128, in _mock_call
          ret_val = effect(*args, **kwargs)
        File "/home/atagar/Desktop/stem/test/unit/util/proc.py", line 262, in <lambda>
          '/proc/net/tcp': io.BytesIO(''),
      TypeError: 'str' does not support the buffer interface
---
 test/unit/util/proc.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/unit/util/proc.py b/test/unit/util/proc.py
index a828981..e8858f1 100644
--- a/test/unit/util/proc.py
+++ b/test/unit/util/proc.py
@@ -259,9 +259,9 @@ class TestProc(unittest.TestCase):
     }[param]
 
     open_mock.side_effect = lambda param, mode: {
-      '/proc/net/tcp': io.BytesIO(''),
+      '/proc/net/tcp': io.BytesIO(b''),
       '/proc/net/tcp6': io.BytesIO(TCP6_CONTENT),
-      '/proc/net/udp': io.BytesIO(''),
+      '/proc/net/udp': io.BytesIO(b''),
     }[param]
 
     expected_results = [
@@ -287,9 +287,9 @@ class TestProc(unittest.TestCase):
     }[param]
 
     open_mock.side_effect = lambda param, mode: {
-      '/proc/net/tcp': io.BytesIO(''),
+      '/proc/net/tcp': io.BytesIO(b''),
       '/proc/net/tcp6': io.BytesIO(TCP6_CONTENT),
-      '/proc/net/udp': io.BytesIO(''),
+      '/proc/net/udp': io.BytesIO(b''),
     }[param]
 
     expected_results = [

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits