[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Fixing python 3 testing issue with key certs
commit bfd5a667f150d4fef77c6a730432494ee930610b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Oct 13 13:20:08 2013 -0700
Fixing python 3 testing issue with key certs
Test file wasn't being opened in bytes mode, causing...
======================================================================
ERROR: test_metrics_cert
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/atagar/Desktop/stem/test/data/python3/test/integ/descriptor/networkstatus.py", line 178, in test_metrics_cert
cert = next(stem.descriptor.parse_file(cert_file))
File "/home/atagar/Desktop/stem/test/data/python3/stem/descriptor/__init__.py", line 200, in parse_file
for desc in file_parser(descriptor_file):
File "/home/atagar/Desktop/stem/test/data/python3/stem/descriptor/__init__.py", line 241, in _parse_metrics_file
for desc in stem.descriptor.networkstatus._parse_file_key_certs(descriptor_file, validate = validate, **kwargs):
File "/home/atagar/Desktop/stem/test/data/python3/stem/descriptor/networkstatus.py", line 252, in _parse_file_key_certs
yield stem.descriptor.networkstatus.KeyCertificate(bytes.join(b"", keycert_content), validate = validate)
TypeError: sequence item 0: expected bytes, str found
---
stem/descriptor/__init__.py | 4 +++-
test/integ/descriptor/networkstatus.py | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index d388fd0..d6b007e 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -371,7 +371,9 @@ def _read_until_keywords(keywords, descriptor_file, inclusive = False, ignore_fi
:param int end_position: end if we reach this point in the file
:param bool include_ending_keyword: provides the keyword we broke on if **True**
- :returns: **list** with the lines until we find one of the keywords, this is a two value tuple with the ending keyword if include_ending_keyword is **True**
+ :returns: **list** with the lines until we find one of the keywords, this is
+ a two value tuple with the ending keyword if include_ending_keyword is
+ **True**
"""
content = None if skip else []
diff --git a/test/integ/descriptor/networkstatus.py b/test/integ/descriptor/networkstatus.py
index 7e07939..5209f51 100644
--- a/test/integ/descriptor/networkstatus.py
+++ b/test/integ/descriptor/networkstatus.py
@@ -174,7 +174,7 @@ GM9hAsAMRX9Ogqhq5UjDNqEsvDKuyVeyh7unSZEOip9Zr6K/+7VsVPNb8vfBRBjo
cert_path = get_resource("metrics_cert")
- with open(cert_path) as cert_file:
+ with open(cert_path, 'rb') as cert_file:
cert = next(stem.descriptor.parse_file(cert_file))
self.assertEquals(3, cert.version)
self.assertEquals(None, cert.address)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits