mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 09:13:23 +00:00
fix #429: include a trailing newline in the JSON cassette format
It is a common convention for text files (esp. in Linux) to end with a newline.
This commit is contained in:
committed by
Kevin McCarthy
parent
a351621d92
commit
1d0fdbaa13
@@ -13,7 +13,9 @@ def test_set_serializer_default_config(tmpdir, httpbin):
|
||||
urlopen(httpbin.url + "/get")
|
||||
|
||||
with open(str(tmpdir.join("test.json"))) as f:
|
||||
assert json.loads(f.read())
|
||||
file_content = f.read()
|
||||
assert file_content.endswith("\n")
|
||||
assert json.loads(file_content)
|
||||
|
||||
|
||||
def test_default_set_cassette_library_dir(tmpdir, httpbin):
|
||||
|
||||
@@ -16,7 +16,7 @@ def serialize(cassette_dict):
|
||||
)
|
||||
|
||||
try:
|
||||
return json.dumps(cassette_dict, indent=4)
|
||||
return json.dumps(cassette_dict, indent=4) + "\n"
|
||||
except UnicodeDecodeError as original: # py2
|
||||
raise UnicodeDecodeError(
|
||||
original.encoding,
|
||||
|
||||
Reference in New Issue
Block a user