Bug 1322862 - Compare unicode strings in Python test. r=whimboo, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Tue, 03 Jan 2017 18:45:35 +0000
changeset 480399 55fa23c4fe239af7f1d94155ce4457cd56951622
parent 480398 4786fd72894dc9c5f0f862eb240ce6c893d9a7be
child 480400 80a2d38b0b2216e3ef89975f27e2d0a764d7fb24
push id44524
push usermartin.thomson@gmail.com
push dateWed, 08 Feb 2017 05:10:11 +0000
reviewerswhimboo, test-only
bugs1322862
milestone52.0
Bug 1322862 - Compare unicode strings in Python test. r=whimboo, a=test-only 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)