[tor-commits] [stem/master] With python3 tempfile requires bytes input

atagar at torproject.org atagar at torproject.org
Sun May 28 23:12:02 UTC 2017


commit 747397252a54f57f0efef3f8830b82496f1e36b8
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun May 28 16:07:32 2017 -0700

    With python3 tempfile requires bytes input
    
    Another integ test failure that manifests with python 3.6 but oddly not 3.2...
    
      ======================================================================
      ERROR: test_running_file
      ----------------------------------------------------------------------
      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/integ/interpreter.py", line 52, in test_running_file
          tmp.write('GETINFO config-file\nGETINFO version')
        File "/home/atagar/python3.6/lib/python3.6/tempfile.py", line 483, in func_wrapper
          return func(*args, **kwargs)
      TypeError: a bytes-like object is required, not 'str'
---
 test/integ/interpreter.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/integ/interpreter.py b/test/integ/interpreter.py
index 5cef051..dc8466b 100644
--- a/test/integ/interpreter.py
+++ b/test/integ/interpreter.py
@@ -49,7 +49,7 @@ class TestInterpreter(unittest.TestCase):
     ]
 
     with tempfile.NamedTemporaryFile(prefix = 'test_commands.') as tmp:
-      tmp.write('GETINFO config-file\nGETINFO version')
+      tmp.write(b'GETINFO config-file\nGETINFO version')
       tmp.flush()
 
       self.assertEqual(expected, _run_prompt('--run', tmp.name))





More information about the tor-commits mailing list