Fix test_conflicting_post_params to work on pytest 5 (#5305)

The non-contextmanager form of pytest.raises was removed in pytest 5.
http://doc.pytest.org/en/latest/deprecations.html#raises-warns-with-a-string-as-the-second-argument

It was used here to support Python < 2.7, but that is no longer needed.
https://github.com/psf/requests/pull/1503#issuecomment-22333666

Fixes https://github.com/psf/requests/issues/5304
This commit is contained in:
Miro Hrončok
2020-05-09 06:58:03 +02:00
committed by GitHub
parent 251f73f65d
commit 427e8eb1e7
+4 -2
View File
@@ -774,8 +774,10 @@ class TestRequests:
def test_conflicting_post_params(self, httpbin):
url = httpbin('post')
with open('Pipfile') as f:
pytest.raises(ValueError, "requests.post(url, data='[{\"some\": \"data\"}]', files={'some': f})")
pytest.raises(ValueError, "requests.post(url, data=u('[{\"some\": \"data\"}]'), files={'some': f})")
with pytest.raises(ValueError):
requests.post(url, data='[{"some": "data"}]', files={'some': f})
with pytest.raises(ValueError):
requests.post(url, data=u('[{"some": "data"}]'), files={'some': f})
def test_request_ok_set(self, httpbin):
r = requests.get(httpbin('status', '404'))