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

[tor-commits] [stem/master] Ensure CLOCK_TICK is what we expect for unit tests



commit 3fb2faa5a295d22f08bb7aeb1d41aab46d87e564
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Aug 20 10:54:21 2017 -0700

    Ensure CLOCK_TICK is what we expect for unit tests
    
    yurivict271 points out that several tests of ours are failing on FreeBSD. First
    one is a unit test. The values are based on a CLOCK_TICK constant so that's
    probably why our results differ.
    
      ======================================================================
      FAIL: test_stats
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/usr/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
          return func(*args, **keywargs)
        File "/usr/ports/security/py-stem/work/stem-1.5.4/test/unit/util/proc.py", line 138, in test_stats
          self.assertEqual(response, proc.stats(24062, *args))
      AssertionError: Tuples differ: ('0.13',) != ('0.1015625',)
    
      First differing element 0:
      '0.13'
      '0.1015625'
    
      - ('0.13',)
      + ('0.1015625',)
    
      ----------------------------------------------------------------------
      Ran 10 tests in 0.021s
---
 test/unit/util/proc.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/unit/util/proc.py b/test/unit/util/proc.py
index b4e3aab5..a172fcb4 100644
--- a/test/unit/util/proc.py
+++ b/test/unit/util/proc.py
@@ -100,6 +100,7 @@ class TestProc(unittest.TestCase):
 
   @patch('stem.util.proc._get_line')
   @patch('stem.util.proc.system_start_time', Mock(return_value = 10))
+  @patch('stem.util.proc.CLOCK_TICKS', 100)
   def test_stats(self, get_line_mock):
     """
     Tests stats() with all combinations of stat_type arguments.

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