[New-bugs-announce] [issue19811] test_pathlib: "The directory is not empty" error on os.rmdir()

STINNER Victor report at bugs.python.org
Wed Nov 27 11:45:08 CET 2013


New submission from STINNER Victor:

test_pathlib should use test.support.rmtree() instead of shutil.rmtree(). The function in support tries harder on Windows.

test_pathlib may also create an unique temporary directory at each test run instead of using a global variable BASE: see below, tests are failing because the directory already exist. (Well, this issue is a consequence of the first one.)

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/3476/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 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_4528\\@test_4528_tmp\\dirC\\dirD'

======================================================================
ERROR: test_touch_nochange (test.test_pathlib.WindowsPathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py", line 1081, in setUp
    os.mkdir(BASE)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_4528\\@test_4528_tmp'

======================================================================
ERROR: test_unlink (test.test_pathlib.WindowsPathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py", line 1081, in setUp
    os.mkdir(BASE)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_4528\\@test_4528_tmp'

======================================================================
ERROR: test_with (test.test_pathlib.WindowsPathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py", line 1081, in setUp
    os.mkdir(BASE)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_4528\\@test_4528_tmp'

----------------------------------------------------------------------

----------
components: Windows
messages: 204571
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: test_pathlib: "The directory is not empty" error on os.rmdir()
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19811>
_______________________________________


More information about the New-bugs-announce mailing list