Skip to content

Commit e1f97e4

Browse files
authored
Merge pull request pytest-dev#4872 from blueyed/_ensure_supporting_files
cacheprovider: _ensure_supporting_files: remove unused branches
2 parents 44c9407 + 2d2f6cd commit e1f97e4

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/_pytest/cacheprovider.py

+10-13
Original file line numberDiff line numberDiff line change
@@ -132,24 +132,21 @@ def set(self, key, value):
132132
else:
133133
with f:
134134
json.dump(value, f, indent=2, sort_keys=True)
135+
135136
if not cache_dir_exists_already:
136137
self._ensure_supporting_files()
137138

138139
def _ensure_supporting_files(self):
139140
"""Create supporting files in the cache dir that are not really part of the cache."""
140-
if self._cachedir.is_dir():
141-
readme_path = self._cachedir / "README.md"
142-
if not readme_path.is_file():
143-
readme_path.write_text(README_CONTENT)
144-
145-
gitignore_path = self._cachedir.joinpath(".gitignore")
146-
if not gitignore_path.is_file():
147-
msg = u"# Created by pytest automatically.\n*"
148-
gitignore_path.write_text(msg, encoding="UTF-8")
149-
150-
cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG")
151-
if not cachedir_tag_path.is_file():
152-
cachedir_tag_path.write_bytes(CACHEDIR_TAG_CONTENT)
141+
readme_path = self._cachedir / "README.md"
142+
readme_path.write_text(README_CONTENT)
143+
144+
gitignore_path = self._cachedir.joinpath(".gitignore")
145+
msg = u"# Created by pytest automatically.\n*"
146+
gitignore_path.write_text(msg, encoding="UTF-8")
147+
148+
cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG")
149+
cachedir_tag_path.write_bytes(CACHEDIR_TAG_CONTENT)
153150

154151

155152
class LFPlugin(object):

0 commit comments

Comments
 (0)