[tor-commits] [bridgedb/master] Scheduling tests are timezone sensitive

phw at torproject.org phw at torproject.org
Wed Feb 19 18:26:38 UTC 2020


commit 34d1eeb019d771f4eb9b02f5a5f4dbf985d46528
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jan 19 17:10:50 2020 -0800

    Scheduling tests are timezone sensitive
    
    This one isn't python 3 related but rather simply a BridgeDB bug when the
    system's local time isn't UTC...
    
      Traceback (most recent call last):
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_schedule.py", line 191, in test_ScheduledInterval_getInterval_seconds
          self._check_getInterval(10, 'seconds', 60)
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_schedule.py", line 173, in _check_getInterval
          self.assertApproximates(now, secs, variance)
        File "/usr/local/lib/python3.5/dist-packages/twisted/trial/_synctest.py", line 562, in assertApproximates
          raise self.failureException(msg or "%s ~== %s" % (first, second))
      twisted.trial.unittest.FailTest: 1579475685 ~== 1579446840
    
    Test results changed as follows...
    
      before: FAILED (skips=115, failures=26, successes=843)
      after:  FAILED (skips=115, failures=23, successes=846)
---
 bridgedb/schedule.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bridgedb/schedule.py b/bridgedb/schedule.py
index 4704130..a2ebf6a 100644
--- a/bridgedb/schedule.py
+++ b/bridgedb/schedule.py
@@ -49,7 +49,7 @@ def fromUnixSeconds(timestamp):
     :param int timestamp: A timestamp in Unix Era seconds.
     :rtype: :any:`datetime.datetime`
     """
-    return datetime.fromtimestamp(timestamp)
+    return datetime.utcfromtimestamp(timestamp)
 
 
 class ISchedule(interface.Interface):





More information about the tor-commits mailing list