[tor-commits] [stem/master] Converting str stats for proc tests

atagar at torproject.org atagar at torproject.org
Sat Feb 2 18:20:49 UTC 2013


commit 6a85a34c753f34c7cc79f4ad4e9f67d92bce1046
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jan 27 19:01:32 2013 -0800

    Converting str stats for proc tests
    
    The proc tests were comparing strings with floats. It coincidentally passed,
    but wasn't really testing what we wanted. In python 3.x the comparisons fail
    due to the type mismatch.
    
    ======================================================================
    ERROR: test_get_stats
    ----------------------------------------------------------------------
    Traceback:
      File "/home/atagar/Desktop/stem/test/data/python3/test/integ/util/proc.py", line 74, in test_get_stats
        self.assertTrue(utime > 0)
    TypeError: unorderable types: str() > int()
---
 test/integ/util/proc.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/integ/util/proc.py b/test/integ/util/proc.py
index d184fe4..e6d1534 100644
--- a/test/integ/util/proc.py
+++ b/test/integ/util/proc.py
@@ -71,9 +71,9 @@ class TestProc(unittest.TestCase):
     command, utime, stime, start_time = proc.get_stats(tor_pid, 'command', 'utime', 'stime', 'start time')
 
     self.assertEquals('tor', command)
-    self.assertTrue(utime > 0)
-    self.assertTrue(stime > 0)
-    self.assertTrue(start_time > proc.get_system_start_time())
+    self.assertTrue(float(utime) > 0)
+    self.assertTrue(float(stime) > 0)
+    self.assertTrue(float(start_time) > proc.get_system_start_time())
 
   def test_get_connections(self):
     """





More information about the tor-commits mailing list