diff options
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r-- | Lib/test/test_support.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index ba36448ec8..4bc661945a 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -9,6 +9,7 @@ import socket import sys import os import os.path +import shutil import warnings import unittest @@ -64,6 +65,14 @@ def unlink(filename): except OSError: pass +def rmtree(path): + try: + shutil.rmtree(path) + except OSError as e: + # Unix returns ENOENT, Windows returns ESRCH. + if e.errno not in (errno.ENOENT, errno.ESRCH): + raise + def forget(modname): '''"Forget" a module was ever imported by removing it from sys.modules and deleting any .pyc and .pyo files.''' |