diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2018-09-14 15:15:12 -0300 |
---|---|---|
committer | Bruno Oliveira <nicoddemus@gmail.com> | 2018-09-14 15:16:40 -0300 |
commit | 9aa6b0903bd0f2a5ecb83cdecbe0c533f8e93938 (patch) | |
tree | 56b71f7cfc499fc5703b96b035d212bb58715011 /testing/test_cacheprovider.py | |
parent | 49800ea13434ee08e2d8e5b1d1b7a3fb4061b4af (diff) | |
download | pytest-9aa6b0903bd0f2a5ecb83cdecbe0c533f8e93938.tar.gz |
.pytest_cache is now automatically ignored by Git
Diffstat (limited to 'testing/test_cacheprovider.py')
-rw-r--r-- | testing/test_cacheprovider.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index 6d425f95b..5d73dc846 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -884,3 +884,14 @@ class TestReadme(object): ) testdir.runpytest() assert self.check_readme(testdir) is True + + +def test_gitignore(testdir): + """Ensure we automatically create .gitignore file in the pytest_cache directory (#3286).""" + from _pytest.cacheprovider import Cache + + config = testdir.parseconfig() + cache = Cache.for_config(config) + cache.set("foo", "bar") + msg = "# created by pytest automatically, do not change\n*" + assert cache._cachedir.joinpath(".gitignore").read_text(encoding="UTF-8") == msg |