[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Message integ tests compatability issues
commit 26374bafd5957d3039cf10596de0f7a021f1afb9
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Thu Oct 20 09:49:45 2011 -0700
Message integ tests compatability issues
The message integration tests had compatability issues with...
- Newer python versions (2.6 -> 2.7) due to an unexpected failure when calling
close() on the socket's file object. We're operating with a closed socket at
that time so all bets are off about if this should/shouldn't raise so the
difference in behavior just warranted a testing workaround.
- Older tor versions don't support 'GETINFO config-text'. I've left this as a
TODO note for now and will add a version check for that test later.
---
test/integ/message.py | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/test/integ/message.py b/test/integ/message.py
index 46f20d2..053e9df 100644
--- a/test/integ/message.py
+++ b/test/integ/message.py
@@ -60,15 +60,20 @@ class TestMessageFunctions(unittest.TestCase):
self.assertRaises(stem.types.ControlSocketClosed, stem.types.read_message, control_socket_file)
# Closing the file handler, however, will cause a different type of error.
+ # This seems to depend on the python version, in 2.6 we get an
+ # AttributeError and in 2.7 the close() call raises...
+ # error: [Errno 32] Broken pipe
- control_socket_file.close()
- control_socket_file.write("GETINFO version\r\n")
-
- # receives: AttributeError: 'NoneType' object has no attribute 'sendall'
- self.assertRaises(AttributeError, control_socket_file.flush)
-
- # receives: stem.types.ControlSocketClosed: socket file has been closed
- self.assertRaises(stem.types.ControlSocketClosed, stem.types.read_message, control_socket_file)
+ try:
+ control_socket_file.close()
+ control_socket_file.write("GETINFO version\r\n")
+
+ # receives: AttributeError: 'NoneType' object has no attribute 'sendall'
+ self.assertRaises(AttributeError, control_socket_file.flush)
+
+ # receives: stem.types.ControlSocketClosed: socket file has been closed
+ self.assertRaises(stem.types.ControlSocketClosed, stem.types.read_message, control_socket_file)
+ except: pass
def test_invalid_command(self):
"""
@@ -135,6 +140,9 @@ class TestMessageFunctions(unittest.TestCase):
Parses the 'GETINFO config-text' response.
"""
+ # TODO: add a 0.2.2.7-alpha version check for this test (that was when
+ # 'GETINFO config-text' was added)
+
# We can't be certain of the order, and there may be extra config-text
# entries as per...
# https://trac.torproject.org/projects/tor/ticket/2362
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits