diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py b/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py index 9268e7175d30..6961be880065 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py @@ -24,8 +24,9 @@ class TestTimeouts(MarionetteTestCase): def test_page_timeout_fail(self): self.marionette.timeout.page_load = 0 - test_html = self.marionette.absolute_url("test.html") - self.assertRaises(MarionetteException, self.marionette.navigate, test_html) + test_html = self.marionette.absolute_url("slow") + with self.assertRaises(MarionetteException): + self.marionette.navigate(test_html) def test_page_timeout_pass(self): self.marionette.timeout.page_load = 60 @@ -36,9 +37,11 @@ class TestTimeouts(MarionetteTestCase): test_html = self.marionette.absolute_url("test.html") self.marionette.navigate(test_html) self.marionette.timeout.implicit = 1 - self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page") + with self.assertRaises(NoSuchElementException): + self.marionette.find_element(By.ID, "I'm not on the page") self.marionette.timeout.implicit = 0 - self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page") + with self.assertRaises(NoSuchElementException): + self.marionette.find_element(By.ID, "I'm not on the page") @skip_if_mobile("Bug 1317121 - android emulator is too slow") def test_search_timeout_found_settimeout(self): @@ -82,7 +85,8 @@ class TestTimeouts(MarionetteTestCase): test_html = self.marionette.absolute_url("test.html") self.marionette.navigate(test_html) self.marionette.timeout.script = 1 - self.assertRaises(ScriptTimeoutException, self.marionette.execute_async_script, "var x = 1;") + with self.assertRaises(ScriptTimeoutException): + self.marionette.execute_async_script("var x = 1;") def test_no_timeout_settimeout(self): test_html = self.marionette.absolute_url("test.html")