Skip to content

Commit 427e8eb

Browse files
authored
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. #1503 (comment) Fixes #5304
1 parent 251f73f commit 427e8eb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_requests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,10 @@ def __len__(self):
774774
def test_conflicting_post_params(self, httpbin):
775775
url = httpbin('post')
776776
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})
779781

780782
def test_request_ok_set(self, httpbin):
781783
r = requests.get(httpbin('status', '404'))

0 commit comments

Comments
 (0)