]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Merge pull request #236 from daira/2725.timezone-test.0 master
authorBrian Warner <warner@lothar.com>
Mon, 8 Feb 2016 22:39:28 +0000 (14:39 -0800)
committerBrian Warner <warner@lothar.com>
Mon, 8 Feb 2016 22:39:28 +0000 (14:39 -0800)
Fix tests on platforms without time.tzset (e.g. Windows)

1  2 
src/allmydata/test/test_util.py

index 69d3c747dae7842fea8d59dd0f87b7a65e702ce8,be5541e8852d79f8a3a5672652709af8851fa241..e59e14aba6e92c4625896e24c6a20f015d38932e
@@@ -932,6 -932,10 +932,10 @@@ class TimeFormat(unittest.TestCase, Tim
          # time_format.iso_utc_time_to_localseconds() breaks if the timezone is
          # Europe/London.  (As soon as this unit test is done then I'll change
          # that implementation to something that works even in this case...)
+         if not self.have_working_tzset():
+             raise unittest.SkipTest("This test can't be run on a platform without time.tzset().")
          self.setTimezone("Europe/London")
          return self._help_test_epoch()
  
      def test_format_time_y2038(self):
          seconds_per_day = 60*60*24
          leap_years_1970_to_2047_inclusive = ((2044 - 1968) // 4)
 -        self.failUnlessEqual(time_format.format_time(time.gmtime(seconds_per_day*((2048 - 1970)*365+leap_years_1970_to_2047_inclusive))), '2048-01-01 00:00:00')
 -
 -    test_format_time_y2038.todo = "This test is known to fail on systems with 32-bit time_t."
 +        try:
 +            self.failUnlessEqual(time_format.format_time(time.gmtime(seconds_per_day*((2048 - 1970)*365+leap_years_1970_to_2047_inclusive))), '2048-01-01 00:00:00')
 +        except unittest.FailTest:
 +            raise unittest.SkipTest("Note: this system cannot handle dates after 2037.")
  
      def test_format_delta(self):
          time_1 = 1389812723