]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Multiple context managers supported in 2.7+
authorHugo <hugovk@users.noreply.github.com>
Thu, 7 Dec 2017 11:26:27 +0000 (13:26 +0200)
committerHugo <hugovk@users.noreply.github.com>
Mon, 15 Jan 2018 07:54:11 +0000 (09:54 +0200)
tests/integration/test_requests.py

index 4229a0fa54400f6ea00bd2c4fe054eec768a149b..81e78bfbd1e24652df37d69e7587e67bd2eb742f 100644 (file)
@@ -249,10 +249,8 @@ def test_nested_cassettes_with_session_created_before_nesting(httpbin_both, tmpd
 def test_post_file(tmpdir, httpbin_both):
     '''Ensure that we handle posting a file.'''
     url = httpbin_both + '/post'
-    with vcr.use_cassette(str(tmpdir.join('post_file.yaml'))) as cass:
-        # Don't use 2.7+ only style ',' separated with here because we support python 2.6
-        with open('tox.ini') as f:
-            original_response = requests.post(url, f).content
+    with vcr.use_cassette(str(tmpdir.join('post_file.yaml'))) as cass, open('tox.ini') as f:
+        original_response = requests.post(url, f).content
 
     # This also tests that we do the right thing with matching the body when they are files.
     with vcr.use_cassette(str(tmpdir.join('post_file.yaml')),