Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_pathlib: "The directory is not empty" error on os.rmdir() #64010

Closed
vstinner opened this issue Nov 27, 2013 · 2 comments
Closed

test_pathlib: "The directory is not empty" error on os.rmdir() #64010

vstinner opened this issue Nov 27, 2013 · 2 comments

Comments

@vstinner
Copy link
Member

BPO 19811
Nosy @pitrou, @vstinner
Superseder
  • bpo-19629: support.rmtree fails on symlinks under Windows
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2013-11-27.13:45:48.321>
    created_at = <Date 2013-11-27.10:45:08.227>
    labels = ['OS-windows']
    title = 'test_pathlib: "The directory is not empty" error on os.rmdir()'
    updated_at = <Date 2014-07-21.17:20:29.766>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2014-07-21.17:20:29.766>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-11-27.13:45:48.321>
    closer = 'pitrou'
    components = ['Windows']
    creation = <Date 2013-11-27.10:45:08.227>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 19811
    keywords = []
    message_count = 2.0
    messages = ['204571', '223591']
    nosy_count = 3.0
    nosy_names = ['pitrou', 'vstinner', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '19629'
    type = None
    url = 'https://bugs.python.org/issue19811'
    versions = ['Python 3.4']

    @vstinner
    Copy link
    Member Author

    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'

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 21, 2014

    New changeset 1db5cde4958f by Victor Stinner in branch '3.4':
    Issue bpo-19811, bpo-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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants