Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/_pytest/cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,18 @@ def set(self, key, value):
def _ensure_supporting_files(self):
"""Create supporting files in the cache dir that are not really part of the cache."""
readme_path = self._cachedir / "README.md"
assert not readme_path.exists(), "{} exists already".format(readme_path)
readme_path.write_text(README_CONTENT)

gitignore_path = self._cachedir.joinpath(".gitignore")
msg = u"# Created by pytest automatically.\n*"
assert not gitignore_path.exists(), "{} exists already".format(gitignore_path)
gitignore_path.write_text(msg, encoding="UTF-8")

cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG")
assert not cachedir_tag_path.exists(), "{} exists already".format(
cachedir_tag_path
)
cachedir_tag_path.write_bytes(CACHEDIR_TAG_CONTENT)


Expand Down
2 changes: 1 addition & 1 deletion testing/test_cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def test_always_passes():
def test_readme_failed(self, testdir):
testdir.makepyfile(
"""
def test_always_passes():
def test_always_fails():
assert 0
"""
)
Expand Down