[tor-commits] [stem/master] Fixing python 3 issue with orphaned annotation exceptions
atagar at torproject.org
atagar at torproject.org
Mon Oct 14 00:42:16 UTC 2013
commit ab86475d484c9c727ba17b9cf39e1661d0e72a8a
Author: Damian Johnson <atagar at torproject.org>
Date: Sun Oct 13 12:49:22 2013 -0700
Fixing python 3 issue with orphaned annotation exceptions
======================================================================
ERROR: test_annotations
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/python3.3/lib/python3.3/unittest/mock.py", line 1087, in patched
return func(*args, **keywargs)
File "/home/atagar/Desktop/stem/test/data/python3/test/unit/descriptor/server_descriptor.py", line 224, in test_annotations
self.assertRaises(ValueError, list, desc_iter)
File "/opt/python3.3/lib/python3.3/unittest/case.py", line 570, in assertRaises
return context.handle('assertRaises', callableObj, args, kwargs)
File "/opt/python3.3/lib/python3.3/unittest/case.py", line 135, in handle
callable_obj(*args, **kwargs)
File "/home/atagar/Desktop/stem/test/data/python3/stem/descriptor/server_descriptor.py", line 157, in _parse_file
raise ValueError('Content conform to being a server descriptor:\n%s' % '\n'.join(annotations))
TypeError: sequence item 0: expected str instance, bytes found
----------------------------------------------------------------------
Ran 31 tests in 0.028s
FAILED (errors=1)
---
stem/descriptor/server_descriptor.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index c84e8b8..d4dbaf3 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -154,7 +154,8 @@ def _parse_file(descriptor_file, is_bridge = False, validate = True, **kwargs):
yield RelayDescriptor(descriptor_text, validate, annotations, **kwargs)
else:
if validate and annotations:
- raise ValueError('Content conform to being a server descriptor:\n%s' % '\n'.join(annotations))
+ orphaned_annotations = stem.util.str_tools._to_unicode(b'\n'.join(annotations))
+ raise ValueError('Content conform to being a server descriptor:\n%s' % orphaned_annotations)
break # done parsing descriptors
More information about the tor-commits
mailing list