add reamde for .pytest_cache

method - `ensure_readme()`
This commit is contained in:
avirlrma 2018-06-21 13:10:42 +05:30
parent 9d60cf25c0
commit 31f089db6a
1 changed files with 16 additions and 0 deletions

View File

@ -103,6 +103,22 @@ class Cache(object):
with f:
self.trace("cache-write %s: %r" % (key, value))
json.dump(value, f, indent=2, sort_keys=True)
self._ensure_readme()
def _ensure_readme(self):
content_readme = '''# pytest cache directory #
This directory contains data from the pytest's cache plugin, \
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
**Do not** commit this to version control.
See [the docs](https://docs.pytest.org/en/latest/cache.html) for more information.
'''
if self._cachedir.check(dir=True):
readme_path = self._cachedir.join("README.md")
if not readme_path.check(file=True):
readme_path.write(content_readme)
class LFPlugin(object):