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

John Arbash Meinel john at arbash-meinel.com
Thu Apr 19 21:30:12 BST 2007


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

Alexander Belchenko wrote:

...

> 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?
> 
> [µ]

Well, these tests pass for me on win32. So it may be a timing thing on
Win32. (The file hasn't had a chance to close yet).

We could try:

=== modified file 'bzrlib/tests/test_versionedfile.py'
- --- bzrlib/tests/test_versionedfile.py  2007-03-02 17:09:40 +0000
+++ bzrlib/tests/test_versionedfile.py  2007-04-19 20:28:22 +0000
@@ -931,6 +931,10 @@
         # try an empty file access
         readonly_vf = self.get_factory()('foo',
get_transport(self.get_readonly_url('.')))
         self.assertEqual([], readonly_vf.versions())
+
+        # Make sure readonly_vf has let go of the file
+        del readonly_vf
+
         # now with feeling.
         vf.add_lines('1', [], ['a\n'])
         vf.add_lines('2', ['1'], ['b\n', 'a\n'])


Which at least makes it a bit more obvious that readonly_vf should have
let go of the file.

If it still fails for you, you could try adding:

import gc
gc.collect()

It might also be a python2.4 versus 2.5 issue.

I'll try installing 2.5 and see if I can get it to fail.

John
=:->


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

iD8DBQFGJ9FTJdeBCYSNAAMRAkApAJ4sxAuCzYSGH9PnHzspyAhBIkLHKgCeMvA6
2m1ZVANQTHZLx1FtDHTiYnE=
=vvOH
-----END PGP SIGNATURE-----



More information about the bazaar mailing list