Title: [286261] trunk/Tools
Revision
286261
Author
lmo...@igalia.com
Date
2021-11-29 13:34:35 -0800 (Mon, 29 Nov 2021)

Log Message

[webkitcorepy] Environment: Sort values before comparing in unittest
https://bugs.webkit.org/show_bug.cgi?id=233582

Reviewed by Jonathan Bedard.

While Python3.6+'s dicts happen to keep insertion order, `os.listdir`
does not guarantee the order of the listed items[1]. This may cause
the Environment unittest to fail when comparing to the fixed expected
data, as it has been happending in some GTK/WPE bots.

[1] https://docs.python.org/3/library/os.html#os.listdir

* Scripts/libraries/webkitcorepy/webkitcorepy/tests/environment_unittest.py:
(TestEnvironment.test_list):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (286260 => 286261)


--- trunk/Tools/ChangeLog	2021-11-29 21:24:56 UTC (rev 286260)
+++ trunk/Tools/ChangeLog	2021-11-29 21:34:35 UTC (rev 286261)
@@ -1,3 +1,20 @@
+2021-11-29  Lauro Moura  <lmo...@igalia.com>
+
+        [webkitcorepy] Environment: Sort values before comparing in unittest
+        https://bugs.webkit.org/show_bug.cgi?id=233582
+
+        Reviewed by Jonathan Bedard.
+
+        While Python3.6+'s dicts happen to keep insertion order, `os.listdir`
+        does not guarantee the order of the listed items[1]. This may cause
+        the Environment unittest to fail when comparing to the fixed expected
+        data, as it has been happending in some GTK/WPE bots.
+
+        [1] https://docs.python.org/3/library/os.html#os.listdir
+
+        * Scripts/libraries/webkitcorepy/webkitcorepy/tests/environment_unittest.py:
+        (TestEnvironment.test_list):
+
 2021-11-29  Wenson Hsieh  <wenson_hs...@apple.com>
 
         WKContentView should allow -captureTextFromCamera: with a caret selection unless the sender is the callout bar

Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/environment_unittest.py (286260 => 286261)


--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/environment_unittest.py	2021-11-29 21:24:56 UTC (rev 286260)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/environment_unittest.py	2021-11-29 21:34:35 UTC (rev 286261)
@@ -59,16 +59,16 @@
 
             Environment.instance(self.path).load()
             self.assertEqual(
-                list(Environment.instance(self.path).keys()),
-                ['KEY_A', 'KEY_B'] + list(os.environ.keys()),
+                sorted(list(Environment.instance(self.path).keys())),
+                sorted(['KEY_A', 'KEY_B'] + list(os.environ.keys())),
             )
             self.assertEqual(
-                list(Environment.instance(self.path).values()),
-                ['value_a', 'value_b'] + list(os.environ.values()),
+                sorted(list(Environment.instance(self.path).values())),
+                sorted(['value_a', 'value_b'] + list(os.environ.values())),
             )
             self.assertEqual(
-                list(Environment.instance(self.path).items()),
-                [('KEY_A', 'value_a'), ('KEY_B', 'value_b')] + list(os.environ.items()),
+                sorted(list(Environment.instance(self.path).items())),
+                sorted([('KEY_A', 'value_a'), ('KEY_B', 'value_b')] + list(os.environ.items())),
             )
         finally:
             Environment._instance = None
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to