sort out rmtree expectations

This commit is contained in:
Ronny Pfannschmidt
2018-10-01 16:39:24 +02:00
parent 2831cb9ab5
commit 3036914097
4 changed files with 71 additions and 10 deletions

View File

@@ -13,10 +13,9 @@ import attr
import pytest
import json
import shutil
from .compat import _PY2 as PY2
from .pathlib import Path, resolve_from_str
from .pathlib import Path, resolve_from_str, rmtree
README_CONTENT = u"""\
# pytest cache directory #
@@ -39,7 +38,7 @@ class Cache(object):
def for_config(cls, config):
cachedir = cls.cache_dir_from_config(config)
if config.getoption("cacheclear") and cachedir.exists():
shutil.rmtree(str(cachedir))
rmtree(cachedir, force=True)
cachedir.mkdir()
return cls(cachedir, config)