1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

Format project with black (#467)

Format with line length 110 to match flake8

make black part of linting check

Update travis spec for updated black requirements

Add diff output for black on failure

update changelog
This commit is contained in:
Josh Peak
2019-08-24 11:36:35 +10:00
committed by GitHub
parent 75969de601
commit 7caf29735a
70 changed files with 2000 additions and 2217 deletions

View File

@@ -4,7 +4,7 @@ from six.moves.urllib.request import urlopen
def test_once_record_mode(tmpdir, httpbin):
testfile = str(tmpdir.join('recordmode.yml'))
testfile = str(tmpdir.join("recordmode.yml"))
with vcr.use_cassette(testfile, record_mode="once"):
# cassette file doesn't exist, so create.
urlopen(httpbin.url).read()
@@ -17,11 +17,11 @@ def test_once_record_mode(tmpdir, httpbin):
# but, try to access something else from the same cassette, and an
# exception is raised.
with pytest.raises(Exception):
urlopen(httpbin.url + '/get').read()
urlopen(httpbin.url + "/get").read()
def test_once_record_mode_two_times(tmpdir, httpbin):
testfile = str(tmpdir.join('recordmode.yml'))
testfile = str(tmpdir.join("recordmode.yml"))
with vcr.use_cassette(testfile, record_mode="once"):
# get two of the same file
urlopen(httpbin.url).read()
@@ -34,7 +34,7 @@ def test_once_record_mode_two_times(tmpdir, httpbin):
def test_once_mode_three_times(tmpdir, httpbin):
testfile = str(tmpdir.join('recordmode.yml'))
testfile = str(tmpdir.join("recordmode.yml"))
with vcr.use_cassette(testfile, record_mode="once"):
# get three of the same file
urlopen(httpbin.url).read()
@@ -43,7 +43,7 @@ def test_once_mode_three_times(tmpdir, httpbin):
def test_new_episodes_record_mode(tmpdir, httpbin):
testfile = str(tmpdir.join('recordmode.yml'))
testfile = str(tmpdir.join("recordmode.yml"))
with vcr.use_cassette(testfile, record_mode="new_episodes"):
# cassette file doesn't exist, so create.
@@ -58,7 +58,7 @@ def test_new_episodes_record_mode(tmpdir, httpbin):
# in the "new_episodes" record mode, we can add more requests to
# a cassette without repurcussions.
urlopen(httpbin.url + '/get').read()
urlopen(httpbin.url + "/get").read()
# one of the responses has been played
assert cass.play_count == 1
@@ -72,8 +72,8 @@ def test_new_episodes_record_mode(tmpdir, httpbin):
def test_new_episodes_record_mode_two_times(tmpdir, httpbin):
testfile = str(tmpdir.join('recordmode.yml'))
url = httpbin.url + '/bytes/1024'
testfile = str(tmpdir.join("recordmode.yml"))
url = httpbin.url + "/bytes/1024"
with vcr.use_cassette(testfile, record_mode="new_episodes"):
# cassette file doesn't exist, so create.
original_first_response = urlopen(url).read()
@@ -97,7 +97,7 @@ def test_new_episodes_record_mode_two_times(tmpdir, httpbin):
def test_all_record_mode(tmpdir, httpbin):
testfile = str(tmpdir.join('recordmode.yml'))
testfile = str(tmpdir.join("recordmode.yml"))
with vcr.use_cassette(testfile, record_mode="all"):
# cassette file doesn't exist, so create.
@@ -109,7 +109,7 @@ def test_all_record_mode(tmpdir, httpbin):
# in the "all" record mode, we can add more requests to
# a cassette without repurcussions.
urlopen(httpbin.url + '/get').read()
urlopen(httpbin.url + "/get").read()
# The cassette was never actually played, even though it existed.
# that's because, in "all" mode, the requests all go directly to
@@ -120,7 +120,7 @@ def test_all_record_mode(tmpdir, httpbin):
def test_none_record_mode(tmpdir, httpbin):
# Cassette file doesn't exist, yet we are trying to make a request.
# raise hell.
testfile = str(tmpdir.join('recordmode.yml'))
testfile = str(tmpdir.join("recordmode.yml"))
with vcr.use_cassette(testfile, record_mode="none"):
with pytest.raises(Exception):
urlopen(httpbin.url).read()
@@ -128,7 +128,7 @@ def test_none_record_mode(tmpdir, httpbin):
def test_none_record_mode_with_existing_cassette(tmpdir, httpbin):
# create a cassette file
testfile = str(tmpdir.join('recordmode.yml'))
testfile = str(tmpdir.join("recordmode.yml"))
with vcr.use_cassette(testfile, record_mode="all"):
urlopen(httpbin.url).read()
@@ -139,4 +139,4 @@ def test_none_record_mode_with_existing_cassette(tmpdir, httpbin):
assert cass.play_count == 1
# but if I try to hit the net, raise an exception.
with pytest.raises(Exception):
urlopen(httpbin.url + '/get').read()
urlopen(httpbin.url + "/get").read()