Bug 1322862 - Compare unicode strings in Python test; r=whimboo draft
authorAndreas Tolfsen <ato@mozilla.com>
Tue, 03 Jan 2017 18:45:35 +0000
changeset 479432 734c37430d6bd2b00c0ac10bdfba6af5db0f1242
parent 479431 068cd67f3bc6f99c312303c4682c47cd9c5143d7
child 479433 138145d66a93acf8a7f3afa61102cb01e50636e0
push id44253
push userbmo:ato@mozilla.com
push dateMon, 06 Feb 2017 16:59:28 +0000
reviewerswhimboo
bugs1322862
milestone54.0a1
Bug 1322862 - Compare unicode strings in Python test; r=whimboo It has been known to happen that Python occassionally trips up string comparison on Windows and that this is causing intermittent issues. This patch uses unicode strings consistently so that this should not occur. MozReview-Commit-ID: BAdHfiLZzuQ
testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
@@ -31,17 +31,24 @@ class TestNavigate(WindowManagerMixin, M
 
     def tearDown(self):
         self.close_all_windows()
 
         super(TestNavigate, self).tearDown()
 
     @property
     def location_href(self):
-        return self.marionette.execute_script("return window.location.href")
+        # Windows 8 has recently seen a proliferation of intermittent
+        # test failures to do with failing to compare "about:blank" ==
+        # u"about:blank". For the sake of consistenty, we encode the
+        # returned URL as Unicode here to ensure that the values are
+        # absolutely of the same type.
+        #
+        # (https://bugzilla.mozilla.org/show_bug.cgi?id=1322862)
+        return self.marionette.execute_script("return window.location.href").encode("utf-8")
 
     def test_set_location_through_execute_script(self):
         self.marionette.execute_script(
             "window.location.href = '%s'" % self.test_doc)
         Wait(self.marionette).until(
             lambda _: self.test_doc == self.location_href)
         self.assertEqual("Marionette Test", self.marionette.title)