test-webkitpy fails on metered_stream_unittest for non-US West Coast Time Zones
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 19:19:13 +0000 (19:19 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 19:19:13 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83583

Reviewed by Philippe Normand

Updated the unit test to ignore the hours and minutes of the
localtime for time(0), since we can't easily guarantee which
timezone we're in or what timezone rules were in effect on
1/1/1970; this should be mostly fine since we can trust that
time.localtime() will work, although there is the possibility
that we'll screw up the time formatting of which field is the
hours and which is the minutes.

* Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py:
(VerboseTest):
(VerboseTest.test_basic):
(VerboseTest.test_log_after_update):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114014 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py

index 066a669..a4aabcd 100644 (file)
@@ -1,3 +1,23 @@
+2012-04-12  Dirk Pranke  <dpranke@chromium.org>
+
+        test-webkitpy fails on metered_stream_unittest for non-US West Coast Time Zones
+        https://bugs.webkit.org/show_bug.cgi?id=83583
+
+        Reviewed by Philippe Normand
+
+        Updated the unit test to ignore the hours and minutes of the
+        localtime for time(0), since we can't easily guarantee which
+        timezone we're in or what timezone rules were in effect on
+        1/1/1970; this should be mostly fine since we can trust that
+        time.localtime() will work, although there is the possibility
+        that we'll screw up the time formatting of which field is the
+        hours and which is the minutes.
+
+        * Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py:
+        (VerboseTest):
+        (VerboseTest.test_basic):
+        (VerboseTest.test_log_after_update):
+
 2012-04-12  Dominik Rottsches  <dominik.rottsches@linux.intel.com>
 
         Add an EFL Debug Buildbot to the master configuration
index 556e787..b388ec6 100644 (file)
@@ -131,16 +131,23 @@ class VerboseTest(RegularTest):
 
     def test_basic(self):
         buflist = self._basic([0, 1, 2.1, 13, 14.1234])
-        self.assertEquals(buflist, ['16:00:00.000 8675 foo\n', '16:00:01.000 8675 bar\n', '16:00:13.000 8675 baz 2\n', '16:00:14.123 8675 done\n'])
+        # We don't bother to match the hours and minutes of the timestamp since
+        # the local timezone can vary and we can't set that portably and easily.
+        self.assertTrue(re.match('\d\d:\d\d:00.000 8675 foo\n', buflist[0]))
+        self.assertTrue(re.match('\d\d:\d\d:01.000 8675 bar\n', buflist[1]))
+        self.assertTrue(re.match('\d\d:\d\d:13.000 8675 baz 2\n', buflist[2]))
+        self.assertTrue(re.match('\d\d:\d\d:14.123 8675 done\n', buflist[3]))
+        self.assertEquals(len(buflist), 4)
 
     def test_log_after_update(self):
         buflist = self._log_after_update()
-        self.assertEquals(buflist[0], '16:00:00.000 8675 foo\n')
+        self.assertTrue(re.match('\d\d:\d\d:00.000 8675 foo\n', buflist[0]))
 
         # The second argument should have a real timestamp and pid, so we just check the format.
-        self.assertEquals(len(buflist), 2)
         self.assertTrue(re.match('\d\d:\d\d:\d\d.\d\d\d \d+ bar\n', buflist[1]))
 
+        self.assertEquals(len(buflist), 2)
+
     def test_log_args(self):
         self.logger.info('foo %s %d', 'bar', 2)
         self.assertEquals(len(self.buflist), 1)