Created
February 5, 2015 16:02
-
-
Save garrettr/ad6c791748abc310d267 to your computer and use it in GitHub Desktop.
Another rmtree-related test failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=================================== FAILURES =================================== | |
________________________ TestIntegration.test_filenames ________________________ | |
self = <tests.test_unit_integration.TestIntegration testMethod=test_filenames> | |
def tearDown(self): | |
> common.shared_teardown() | |
tests/test_unit_integration.py:81: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/common.py:74: in shared_teardown | |
clean_root() | |
tests/common.py:13: in clean_root | |
shutil.rmtree(config.SECUREDROP_DATA_ROOT) | |
/usr/lib/python2.7/shutil.py:254: in rmtree | |
onerror(os.rmdir, path, sys.exc_info()) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
path = '/tmp/securedrop', ignore_errors = False | |
onerror = <function onerror at 0x3b80c80> | |
def rmtree(path, ignore_errors=False, onerror=None): | |
"""Recursively delete a directory tree. | |
If ignore_errors is set, errors are ignored; otherwise, if onerror | |
is set, it is called to handle the error with arguments (func, | |
path, exc_info) where func is os.listdir, os.remove, or os.rmdir; | |
path is the argument to that function that caused it to fail; and | |
exc_info is a tuple returned by sys.exc_info(). If ignore_errors | |
is false and onerror is None, an exception is raised. | |
""" | |
if ignore_errors: | |
def onerror(*args): | |
pass | |
elif onerror is None: | |
def onerror(*args): | |
raise | |
try: | |
if os.path.islink(path): | |
# symlinks to directories are forbidden, see bug #1669 | |
raise OSError("Cannot call rmtree on a symbolic link") | |
except OSError: | |
onerror(os.path.islink, path, sys.exc_info()) | |
# can't continue even if onerror hook returns | |
return | |
names = [] | |
try: | |
names = os.listdir(path) | |
except os.error, err: | |
onerror(os.listdir, path, sys.exc_info()) | |
for name in names: | |
fullname = os.path.join(path, name) | |
try: | |
mode = os.lstat(fullname).st_mode | |
except os.error: | |
mode = 0 | |
if stat.S_ISDIR(mode): | |
rmtree(fullname, ignore_errors, onerror) | |
else: | |
try: | |
os.remove(fullname) | |
except os.error, err: | |
onerror(os.remove, fullname, sys.exc_info()) | |
try: | |
> os.rmdir(path) | |
E OSError: [Errno 39] Directory not empty: '/tmp/securedrop' | |
/usr/lib/python2.7/shutil.py:252: OSError | |
===================== 1 failed, 43 passed in 30.72 seconds ===================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment