Bug 1524243 - [marionette] Correct calculation of timeout from milliseconds to seconds. r=jgraham
authorHenrik Skupin <mail@hskupin.info>
Thu, 31 Jan 2019 14:31:11 +0000
changeset 456263 71f896682a2ff22e44b7a126281fcd84fe845e46
parent 456262 934099e1c866a27740a22d915535bd2e3e83bf4e
child 456264 7ffb0f9d151b5102e516c496d898d4f4530554d8
push id77204
push userhskupin@mozilla.com
push dateThu, 31 Jan 2019 16:38:53 +0000
treeherderautoland@71f896682a2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1524243
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1524243 - [marionette] Correct calculation of timeout from milliseconds to seconds. r=jgraham Fractions of a second are lost because the division in getting the timeout value operates on decimal valus. As such a timeout of 100ms will result in 0ms. Depends on D18214 Differential Revision: https://phabricator.services.mozilla.com/D18219
testing/marionette/client/marionette_driver/timeout.py
testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
--- a/testing/marionette/client/marionette_driver/timeout.py
+++ b/testing/marionette/client/marionette_driver/timeout.py
@@ -32,17 +32,17 @@ class Timeouts(object):
         ms = sec * 1000
         self._marionette._send_message("WebDriver:SetTimeouts", {name: ms})
 
     def _get(self, name):
         ts = self._marionette._send_message("WebDriver:GetTimeouts")
         if name not in ts:
             raise KeyError()
         ms = ts[name]
-        return ms / 1000
+        return ms / 1000.0
 
     @property
     def script(self):
         """Get the session's script timeout.  This specifies the time
         to wait for injected scripts to finished before interrupting
         them. It is by default 30 seconds.
 
         """
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
@@ -15,16 +15,20 @@ from marionette_driver.marionette import
 from marionette_harness import MarionetteTestCase, run_if_manage_instance, skip_if_mobile
 
 
 class TestTimeouts(MarionetteTestCase):
     def tearDown(self):
         self.marionette.timeout.reset()
         MarionetteTestCase.tearDown(self)
 
+    def test_get_timeout_fraction(self):
+        self.marionette.timeout.script = 0.5
+        self.assertEqual(self.marionette.timeout.script, 0.5)
+
     def test_page_timeout_notdefinetimeout_pass(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
 
     def test_page_timeout_fail(self):
         self.marionette.timeout.page_load = 0
         test_html = self.marionette.absolute_url("slow")
         with self.assertRaises(MarionetteException):