Skip to content

Commit b88f5df

Browse files
authored
Merge pull request #6010 from pytest-dev/asottile-patch-2
Ensure .pytest_cache file has a newline at the end
2 parents 2e11ea6 + 3a40281 commit b88f5df

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/_pytest/cacheprovider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _ensure_supporting_files(self):
135135
readme_path.write_text(README_CONTENT)
136136

137137
gitignore_path = self._cachedir.joinpath(".gitignore")
138-
msg = "# Created by pytest automatically.\n*"
138+
msg = "# Created by pytest automatically.\n*\n"
139139
gitignore_path.write_text(msg, encoding="UTF-8")
140140

141141
cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG")

testing/test_cacheprovider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ def test_gitignore(testdir):
10291029
config = testdir.parseconfig()
10301030
cache = Cache.for_config(config)
10311031
cache.set("foo", "bar")
1032-
msg = "# Created by pytest automatically.\n*"
1032+
msg = "# Created by pytest automatically.\n*\n"
10331033
gitignore_path = cache._cachedir.joinpath(".gitignore")
10341034
assert gitignore_path.read_text(encoding="UTF-8") == msg
10351035

0 commit comments

Comments
 (0)