From 3a402811de5227dd46d3a9ab75a9e75d3ef3097e Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 19 Oct 2019 13:45:15 -0700 Subject: [PATCH] Ensure .pytest_cache file has a newline at the end --- src/_pytest/cacheprovider.py | 2 +- testing/test_cacheprovider.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py index 496931e0f..7a5deaa39 100755 --- a/src/_pytest/cacheprovider.py +++ b/src/_pytest/cacheprovider.py @@ -135,7 +135,7 @@ class Cache: readme_path.write_text(README_CONTENT) gitignore_path = self._cachedir.joinpath(".gitignore") - msg = "# Created by pytest automatically.\n*" + msg = "# Created by pytest automatically.\n*\n" gitignore_path.write_text(msg, encoding="UTF-8") cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG") diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index cbba27e5f..038c11826 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -1029,7 +1029,7 @@ def test_gitignore(testdir): config = testdir.parseconfig() cache = Cache.for_config(config) cache.set("foo", "bar") - msg = "# Created by pytest automatically.\n*" + msg = "# Created by pytest automatically.\n*\n" gitignore_path = cache._cachedir.joinpath(".gitignore") assert gitignore_path.read_text(encoding="UTF-8") == msg