-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
type: infrastructureimprovement to development/releases/CI structureimprovement to development/releases/CI structuretype: selftestsa problem in the tests of pytesta problem in the tests of pytest
Description
- a detailed description of the bug or suggestion
path = '/tmp/pytest-of-travis/garbage-7b2ebcac-468f-4ee5-9433-7967d6217af8'
ignore_errors = False, onerror = <functools.partial object at 0x7f5b3e727788>
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)
/usr/lib/python2.7/shutil.py:247:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python2.7/shutil.py:247: in rmtree
rmtree(fullname, ignore_errors, onerror)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = '/tmp/pytest-of-travis/garbage-7b2ebcac-468f-4ee5-9433-7967d6217af8/test_cache_writefail_permissions0/.pytest_cache'
ignore_errors = False, onerror = <functools.partial object at 0x7f5b3e727788>
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())
E PytestWarning: (rm_rf) unknown function /tmp/pytest-of-travis/garbage-7b2ebcac-468f-4ee5-9433-7967d6217af8/test_cache_writefail_permissions0/.pytest_cache when removing <built-in function listdir>:
E <type 'exceptions.OSError'>: [Errno 13] Permission denied: '/tmp/pytest-of-travis/garbage-7b2ebcac-468f-4ee5-9433-7967d6217af8/test_cache_writefail_permissions0/.pytest_cache'
- output of
pip listfrom the virtual environment you are using
https://travis-ci.org/pytest-dev/pytest/builds/655205329#
- pytest and operating system versions
4.6.10.dev - minimal example if possible
Metadata
Metadata
Assignees
Labels
type: infrastructureimprovement to development/releases/CI structureimprovement to development/releases/CI structuretype: selftestsa problem in the tests of pytesta problem in the tests of pytest