Bug 1524243 - [marionette] Correct calculation of timeout from milliseconds to seconds. r=jgraham a=test-only
authorHenrik Skupin <mail@hskupin.info>
Thu, 31 Jan 2019 14:31:11 +0000
changeset 512837 6eeb1301ae9f2c0aaac9314bf78df9d515e6b342
parent 512836 9cf59044f067672a749b8bc8a68321893c96d97d
child 512838 e86470dd4c333f36a6f858e501f2fb7927c297f9
push id10616
push userarchaeopteryx@coole-files.de
push dateMon, 04 Feb 2019 16:57:19 +0000
treeherdermozilla-beta@e86470dd4c33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham, test-only
bugs1524243
milestone66.0
Bug 1524243 - [marionette] Correct calculation of timeout from milliseconds to seconds. r=jgraham a=test-only 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):