question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
eb-fmezzabottacommented, Mar 9, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found