diff --git a/tests/integration/test_config.py b/tests/integration/test_config.py index 30c90895..4c8c5950 100644 --- a/tests/integration/test_config.py +++ b/tests/integration/test_config.py @@ -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): diff --git a/vcr/serializers/jsonserializer.py b/vcr/serializers/jsonserializer.py index e5ff85a9..5ffef3e6 100644 --- a/vcr/serializers/jsonserializer.py +++ b/vcr/serializers/jsonserializer.py @@ -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,