diff --git a/tests/element_does_not_exist.py b/tests/element_does_not_exist.py index 14ab80a55..aac6dc41d 100644 --- a/tests/element_does_not_exist.py +++ b/tests/element_does_not_exist.py @@ -25,7 +25,7 @@ def test_element_list_raises_with_unicode_query(self): def test_element_list_contains_right_information_and_raises_right_exception(self): "element list contains right information about query and raises nice exception message" - with pytest.raises(ElementDoesNotExist) as cm: + with pytest.raises(ElementDoesNotExist) as err: element_list = self.browser.find_by_css(".element-that-dont-exists") assert "css" == element_list.find_by assert ".element-that-dont-exists" == element_list.query @@ -33,14 +33,13 @@ def test_element_list_contains_right_information_and_raises_right_exception(self expected_message = 'No elements were found with css ".element-that-dont-exists"' - e = cm.exception - assert expected_message == e.args[0] + assert expected_message == err.value.args[0] def test_element_list_raises_when_element_first_doesnt_exists_in_element_context( self, ): "element list raises exception with right information in element context" - with pytest.raises(ElementDoesNotExist) as cm: + with pytest.raises(ElementDoesNotExist) as err: element_list = self.browser.find_by_css("#inside").find_by_css( ".inner-element-that-dont-exists", ) @@ -50,5 +49,4 @@ def test_element_list_raises_when_element_first_doesnt_exists_in_element_context expected_message = 'No elements were found with css ".inner-element-that-dont-exists"' - e = cm.exception - assert expected_message == e.args[0] + assert expected_message == err.value.args[0] diff --git a/tests/test_djangoclient.py b/tests/test_djangoclient.py index a0ee72756..8263af2a7 100644 --- a/tests/test_djangoclient.py +++ b/tests/test_djangoclient.py @@ -75,12 +75,11 @@ def test_can_clear_text_field_content(self): def test_cant_switch_to_frame(self): "django driver should not be able to switch to frames" - with pytest.raises(NotImplementedError) as cm: + with pytest.raises(NotImplementedError) as err: self.browser.get_iframe("frame_123") self.fail() - e = cm.exception - assert "django doesn't support frames." == e.args[0] + assert "django doesn't support frames." == err.value.args[0] def test_simple_type(self): """ diff --git a/tests/test_flaskclient.py b/tests/test_flaskclient.py index db23dd375..9c1e80c83 100644 --- a/tests/test_flaskclient.py +++ b/tests/test_flaskclient.py @@ -90,12 +90,11 @@ def test_can_clear_url_content(self): def test_cant_switch_to_frame(self): "flask should not be able to switch to frames" - with pytest.raises(NotImplementedError) as cm: + with pytest.raises(NotImplementedError) as err: self.browser.get_iframe("frame_123") self.fail() - e = cm.exception - assert "flask doesn't support frames." == e.args[0] + assert "flask doesn't support frames." == err.value.args[0] def test_simple_type(self): """ diff --git a/tests/test_zopetestbrowser.py b/tests/test_zopetestbrowser.py index abaf261d0..87c28b5d0 100644 --- a/tests/test_zopetestbrowser.py +++ b/tests/test_zopetestbrowser.py @@ -53,12 +53,11 @@ def test_forward_to_none_page(self): def test_cant_switch_to_frame(self): "zope.testbrowser should not be able to switch to frames" - with pytest.raises(NotImplementedError) as cm: + with pytest.raises(NotImplementedError) as err: self.browser.get_iframe("frame_123") self.fail() - e = cm.exception - assert "zope.testbrowser doesn't support frames." == e.args[0] + assert "zope.testbrowser doesn't support frames." == err.value.args[0] def test_simple_type(self): """