summaryrefslogtreecommitdiff
path: root/tests/mixins.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mixins.py')
-rw-r--r--tests/mixins.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/mixins.py b/tests/mixins.py
index 4a3347b2..1043c2d2 100644
--- a/tests/mixins.py
+++ b/tests/mixins.py
@@ -10,13 +10,12 @@ Some of these are transitional while working toward pure-pytest style.
import importlib
import os
import os.path
-import shutil
import sys
import pytest
from coverage.misc import SysModuleSaver
-from tests.helpers import change_dir, make_file, remove_files
+from tests.helpers import change_dir, make_file, remove_files, remove_tree
class PytestBase:
@@ -108,9 +107,7 @@ class RestoreModulesMixin:
# resolution is only one second, a changed file might not be
# picked up.
remove_files("*.pyc", "*$py.class")
- if os.path.exists("__pycache__"):
- shutil.rmtree("__pycache__")
-
+ remove_tree("__pycache__")
importlib.invalidate_caches()