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

[tor-commits] [stem/master] Update code to reflect new version parser, all tests pass



commit 9408f4a16a45d608a7d7711215496734902f5f12
Author: Ravi Chandra Padmala <neenaoffline@xxxxxxxxx>
Date:   Thu Mar 29 23:04:17 2012 +0530

    Update code to reflect new version parser, all tests pass
---
 test/integ/socket/control_socket.py |    3 ++-
 test/integ/version.py               |    4 +++-
 test/runner.py                      |    3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/integ/socket/control_socket.py b/test/integ/socket/control_socket.py
index 366501f..b00e381 100644
--- a/test/integ/socket/control_socket.py
+++ b/test/integ/socket/control_socket.py
@@ -33,7 +33,8 @@ class TestControlSocket(unittest.TestCase):
       
       for i in range(100):
         response = control_socket.recv()
-        self.assertEquals("version=%s\nOK" % tor_version, str(response))
+        self.assertTrue(str(response).startswith("version=%s" % tor_version))
+        self.assertTrue(str(response).endswith("\nOK"))
   
   def test_send_closed(self):
     """
diff --git a/test/integ/version.py b/test/integ/version.py
index 833cbd2..bdb22cb 100644
--- a/test/integ/version.py
+++ b/test/integ/version.py
@@ -55,9 +55,11 @@ class TestVersion(unittest.TestCase):
     control_socket.close()
     
     # the getinfo response looks like...
-    # 250-version=0.2.1.30
+    # 250-version=0.2.3.10-alpha-dev (git-65420e4cb5edcd02)
     # 250 OK
     
     tor_version = list(version_response)[0][8:]
+    tor_version = list(version_response)[0]
+    tor_version = tor_version[8:tor_version.find(' ', 8)]
     stem.version.Version(tor_version)
 
diff --git a/test/runner.py b/test/runner.py
index 9169bef..dcc7f9c 100644
--- a/test/runner.py
+++ b/test/runner.py
@@ -408,7 +408,8 @@ class Runner:
       version_response = control_socket.recv()
       control_socket.close()
       
-      tor_version = list(version_response)[0][8:]
+      tor_version = list(version_response)[0]
+      tor_version = tor_version[8:tor_version.find(' ', 8)]
       return stem.version.Version(tor_version)
     except TorInaccessable:
       return stem.version.get_system_tor_version(self.get_tor_command())



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