This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_pathlib: shutil.rmtree() sporadic failures on Windows
Type: Stage: resolved
Components: Tests, Windows Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: support.rmtree fails on symlinks under Windows
View: 19629
Assigned To: Nosy List: nedbat, python-dev, vstinner, zach.ware
Priority: normal Keywords: buildbot

Created on 2014-07-21 16:05 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg223584 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-07-21 16:05
Sometimes, test_pathlib fails because shutil.rmtree() cannot remove a test directory. Example:

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/4833/steps/test/logs/stdio

======================================================================
ERROR: test_touch_common (test.test_pathlib.WindowsPathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py", line 477, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py", line 367, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py", line 376, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py", line 374, in _rmtree_unsafe
    os.rmdir(path)
OSError: [WinError 145] The directory is not empty: 'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_3444\\@test_3444_tmp\\dirB'

The error comes from this cleanup function:

        self.addCleanup(shutil.rmtree, BASE)

I don't understand how rmtree() can fail with "The directory is not empty".

Note: this buildbot runs 4 tests in parallel using the "-j4" command line option of regrtest.
msg223585 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2014-07-21 16:15
FWIW, every use of rmtree I have on Windows occasionally fails this way, parallelism seems not to be a factor.
msg223589 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-07-21 17:07
This looks like a duplicate of #19811, which was closed as a duplicate of #19629.
msg223592 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-07-21 17:20
New changeset 1db5cde4958f by Victor Stinner in branch '3.4':
Issue #19811, #22022: test_pathlib uses support.rmtree() instead of
http://hg.python.org/cpython/rev/1db5cde4958f

New changeset e405bcbf761c by Victor Stinner in branch 'default':
Merge Python 3.4
http://hg.python.org/cpython/rev/e405bcbf761c
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66221
2014-07-21 17:20:30python-devsetnosy: + python-dev
messages: + msg223592
2014-07-21 17:07:13zach.waresetstatus: open -> closed

superseder: support.rmtree fails on symlinks under Windows

nosy: + zach.ware
messages: + msg223589
resolution: duplicate
stage: resolved
2014-07-21 16:15:23nedbatsetnosy: + nedbat
messages: + msg223585
2014-07-21 16:05:04vstinnercreate