[rfc] test_versionedfile.TestWeaveHTTP.test_readonly_http_works fails with PermissionDenied on win32

Alexander Belchenko bialix at ukr.net
Thu Apr 19 14:10:06 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ERROR: #1911 test_readonly_http_works (bzrlib.tests.test_versionedfile.TestWeaveHTTP)

vvvv[log from bzrlib.tests.test_versionedfile.TestWeaveHTTP.test_readonly_http_works]
using pycurl libcurl/7.15.5 OpenSSL/0.9.8c zlib/1.2.3 c-ares/1.3.1

^^^^[log from bzrlib.tests.test_versionedfile.TestWeaveHTTP.test_readonly_http_works]
- ----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\work\selftest.win32\bzrlib\tests\test_versionedfile.py", line 935, in
test_readonly_http_works
    vf.add_lines('1', [], ['a\n'])
  File "E:\work\selftest.win32\bzrlib\versionedfile.py", line 147, in add_lines
    return self._add_lines(version_id, parents, lines, parent_texts)
  File "E:\work\selftest.win32\bzrlib\weave.py", line 1113, in _add_lines
    self._save()
  File "E:\work\selftest.win32\bzrlib\weave.py", line 1140, in _save
    self._filemode)
  File "E:\work\selftest.win32\bzrlib\transport\local.py", line 164, in put_file
    fp.commit()
  File "E:\work\selftest.win32\bzrlib\atomicfile.py", line 111, in commit
    osutils.rename(self.tmpfilename, self.realfilename)
  File "E:\work\selftest.win32\bzrlib\osutils.py", line 325, in _win32_rename
    fancy_rename(old, new, rename_func=os.rename, unlink_func=os.unlink)
  File "E:\work\selftest.win32\bzrlib\osutils.py", line 200, in fancy_rename
    rename_func(new, tmp_name)
OSError: [Errno 13] Permission denied

======================================================================

This error indicate that rename_func try to rename file currently in use.
Is it possible that test Http server don't close file handler properly?

Test code in question is:

class TestReadonlyHttpMixin(object):

    def test_readonly_http_works(self):
        # we should be able to read from http with a versioned file.
        vf = self.get_file()
        # try an empty file access
        readonly_vf = self.get_factory()('foo', get_transport(self.get_readonly_url('.')))
        self.assertEqual([], readonly_vf.versions())
        # now with feeling.
        vf.add_lines('1', [], ['a\n'])

It seems that readonly_vf is opened file and not closed properly at the moment
when add_lines executed.

Any ideas how to debug and fix this tests?
Or it should be knownFailure @ win32?

[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGJ2ouzYr338mxwCURAtHIAJ9BPrE+t5dutxxR/i0eZnESku46bgCeKsBC
swVVvgTbM6QtvqkhOjsLJaE=
=6P/3
-----END PGP SIGNATURE-----



More information about the bazaar mailing list