[MERGE][minor] Make selftest output sane under windows

Martin gzlist at googlemail.com
Fri Jun 29 02:13:56 BST 2007


Problem: every test run by bzr selftest prints an unlink error, which
completely breaks the console summary backtracking and makes it
impossible to keep tabs on what are the actual errors.

Not difficult fix to work out in the end, mostly just waiting for
tests to finish running. Compare the following with what similar would
do under nix for patch reasoning:

>>> import os, shutil
>>> os.mkdir("/bzrtemp")
>>> os.chdir("/bzrtemp")
>>> shutil.rmtree("/bzrtemp")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\lib\shutil.py", line 168, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "C:\Python24\lib\shutil.py", line 166, in rmtree
    os.rmdir(path)
OSError: [Errno 13] Permission denied: '/bzrtemp'
>>> os.path.isdir("/bzrtemp")
True
>>> os.chdir("/")
>>> shutil.rmtree("/bzrtemp")
>>> os.path.isdir("/bzrtemp")
False

Patch attached is not complete selftest unlink cleanup in that there
are still bits left behind when the tests complete (2 dirs, and 601
files), but does make the console output behave as it should without
making anything worse.
Does not deal with general bzrlib.osutils.rmtree failure, which could
be done by either comparing os.getcwd() to os.path.normpath(path) all
the time [bad] or when an error is thrown [better] as doesn't seem to
be an actual problem anywhere but in running the tests, and would be a
more pervasive (not one line) diff.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsuite_unlink.patch
Type: application/octet-stream
Size: 518 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070629/6ca957b7/attachment.obj 


More information about the bazaar mailing list