Last active
December 14, 2015 05:40
-
-
Save echohack/5036874 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import inject_exception2 | |
import requests | |
from mock import patch | |
import nose.tools | |
# ...snippet | |
def test_api_call(): | |
with patch.object(requests, "get") as get_mock: | |
with nose.tools.assert_raises(socket.error) and nose.tools.assert_raises(inject_exception2.ExceededRetries): | |
get_mock.side_effect = socket.error | |
inject_exception2.retry(100, call_api, "http://example.com") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment