Skip to content
Myr

Fix test_conflicting_post_params to work on pytest 5 (#5305)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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

authored by Miro Hrončok · committed by GitHub · parent 251f73f · Browse files · 1 file+4 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−2 removed

  • tests:+4 added−2 removed

1 file+4 added−2 removed

modified:tests/test_requests.py+4 added-2 removed
772 unmodified lines
773774 def test_conflicting_post_params(self, httpbin):775 url = httpbin('post')776 with open('Pipfile') as f:777 pytest.raises(ValueError, "requests.post(url, data='[{\"some\": \"data\"}]', files={'some': f})")778 pytest.raises(ValueError, "requests.post(url, data=u('[{\"some\": \"data\"}]'), files={'some': f})")777 with pytest.raises(ValueError):778 requests.post(url, data='[{"some": "data"}]', files={'some': f})779 with pytest.raises(ValueError):780 requests.post(url, data=u('[{"some": "data"}]'), files={'some': f})781782 def test_request_ok_set(self, httpbin):783 r = requests.get(httpbin('status', '404'))784 assert not r.ok
1745 unmodified lines