Travis-ci build fails trying to remove .pytest_cache
See original GitHub issue- 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 list
from the virtual environment you are using
https://github.com/pytest-dev/pytest/pull/6785
https://travis-ci.org/pytest-dev/pytest/builds/655205329#
- pytest and operating system versions 4.6.10.dev
- minimal example if possible
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Common Build Problems - Travis CI Docs
If your build is failing due to unexpected segmentation faults in the language interpreter, this may be caused by corrupt or invalid caches...
Read more >Before cache doesn't seem to be removing directory. #6732
I've been spending some time optimizing build speed. The cache helped a ton, but there's a small issue where every run we upload...
Read more >How to remove caches on Travis CI? - Stack Overflow
1 Answer 1 · Using the UI: "More options" -> "Caches" on the repo's page · Using the CLI: travis cache --delete ·...
Read more >Deleting a single cache doesn't seem to work anymore
... something in the cached contents is wrong (an error from the developer), and so we want to remove the cache and try...
Read more >Travis caching and incremental builds | by Patrick Bos
Travis CI is the current go-to solution for us (it's open, ... I added the if statement for when I delete my cache...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m gonna be trying to migrate the
4.6.x
branch to use GitHub actions in here https://github.com/pytest-dev/pytest/pull/6884. Travis is completely broken.https://docs.pytest.org/en/latest/py27-py34-deprecation.html#maintenance-of-4-6-x-versions