Opened 14 years ago

Closed 14 years ago

#526 closed defect (fixed)

compactor test for Python bindings fails on Windows

Reported by: Charlie Hull Owned by: Richard Boulton
Priority: normal Milestone: 1.2.5
Component: Xapian-bindings (Python) Version: 1.2.4
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: Microsoft Windows

Description

Running test: compactor... FAILED

pythontest2.py:1505:exceptions.OSError: [Errno 13] Permission denied: 'c:\\docum
e~1\\another\\locals~1\\temp\\tmp9imtqh\\db1\\flintlock', when testing a custom
compactor which merges duplicate metadata
  1503
  1504     finally:
->1505         shutil.rmtree(tmpdir)
  1506
  1507 def test_leak_mset_items():
Traceback (most recent call last):
  File "C:\work\xapian\xapian-releases\xapian-core-1.2.4\win32\Release\Python24\
testsuite2.py", line 201, in runtest
    test_fn()
  File "C:\work\xapian\xapian-releases\xapian-core-1.2.4\win32\Release\Python24\
pythontest2.py", line 1505, in test_compactor
    shutil.rmtree(tmpdir)
  File "C:\Python24\lib\shutil.py", line 163, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Python24\lib\shutil.py", line 168, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "C:\Python24\lib\shutil.py", line 166, in rmtree
    os.remove(fullname)

Attachments (1)

patch_pythontest2.patch (450 bytes ) - added by Charlie Hull 14 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Charlie Hull, 14 years ago

Closing all three databases before attempting to remove the tree appears to fix this issue.

comment:2 by Olly Betts, 14 years ago

Can you attach a patch for the change you made which fixes this?

by Charlie Hull, 14 years ago

Attachment: patch_pythontest2.patch added

comment:3 by Charlie Hull, 14 years ago

Patch attached, but getting a slightly different error:

pythontest2.py:1502:exceptions.OSError: [Errno 13] Permission denied: 'c:\\docum
e~1\\another\\locals~1\\temp\\tmpohw6aw\\db1\\flintlock'
  1500
  1501     finally:
->1502         shutil.rmtree(tmpdir)
  1503
  1504 def test_leak_mset_items():

comment:4 by Olly Betts, 14 years ago

Milestone: 1.2.5

You really need to close them in the finally block, or else if there's an exception you won't close them before trying to delete the directory. I made that change in r15301.

comment:5 by Charlie Hull, 14 years ago

Resolution: fixed
Status: newclosed

You're right of course, and this showed the error was due to not having an up-to-date modern/xapian_wrap.cc - updated this from a snapshot and all tests pass, so closing this bug.

Note: See TracTickets for help on using tickets.