From 2d2f6cd4fdc5b871d3137a5d0ac805ec8359f0c9 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 1 Mar 2019 22:50:37 +0100 Subject: [PATCH] cacheprovider: _ensure_supporting_files: remove unused branches It is only called with empty/new dirs since 0385c273. --- src/_pytest/cacheprovider.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py index 87b2e5426e2..0c25914bbf1 100755 --- a/src/_pytest/cacheprovider.py +++ b/src/_pytest/cacheprovider.py @@ -132,24 +132,21 @@ def set(self, key, value): else: with f: json.dump(value, f, indent=2, sort_keys=True) + if not cache_dir_exists_already: self._ensure_supporting_files() def _ensure_supporting_files(self): """Create supporting files in the cache dir that are not really part of the cache.""" - if self._cachedir.is_dir(): - readme_path = self._cachedir / "README.md" - if not readme_path.is_file(): - readme_path.write_text(README_CONTENT) - - gitignore_path = self._cachedir.joinpath(".gitignore") - if not gitignore_path.is_file(): - msg = u"# Created by pytest automatically.\n*" - gitignore_path.write_text(msg, encoding="UTF-8") - - cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG") - if not cachedir_tag_path.is_file(): - cachedir_tag_path.write_bytes(CACHEDIR_TAG_CONTENT) + readme_path = self._cachedir / "README.md" + readme_path.write_text(README_CONTENT) + + gitignore_path = self._cachedir.joinpath(".gitignore") + msg = u"# Created by pytest automatically.\n*" + gitignore_path.write_text(msg, encoding="UTF-8") + + cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG") + cachedir_tag_path.write_bytes(CACHEDIR_TAG_CONTENT) class LFPlugin(object):