[MERGE REVIEW] win32 tests
Martin Pool
mbp at sourcefrog.net
Wed Apr 5 05:58:57 BST 2006
On 13 Mar 2006, at 09:56 , Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> I've tried running the test suite under win32. I've found a few
> bugs in
> bzr, and some in the test suite. Patch attached, or see bzr.ab.
If this fixes things on Windows and Alexander likes it, +1 from me.
>
> 1. The local transport was returning 0 from append, because tell
> doesn't
> work on a freshly-opened file. Fixed by seeking.
>
> 2. ConfigObj opens files in text mode, causing them to be written with
> DOS line-endings on win32. To date, all of our files have used Unix
> line endings, and I'd rather leave it that way.
>
> 3. One test assumed the temp directory was /tmp/
>
> 4. A couple of tests did mkdir(config_dir), instead of
> ensure_config_dir_exists, which creates *two* directories on win32.
>
> 5. Some tests expected os.getcwd to use '/' as a path separator.
>
> 6. 'bzr missing' could not accept '.' as an argument.
>
> 7. The instrumented ConfigObject's write method didn't a parameter.
>
> 8. Some tests built trees using 'native' encoding, and then expected
> them to have unix file endings.
>
> Why does build_tree default to 'native', anyway? IMHO, it should
> write
> exactly the specified contents to disk.
I would have expected it to write the literal strings too.
>
> class TestOutsideWT(ChrootedTestCase):
> """Test that bzr gives proper errors outside of a working
> tree."""
>
> def test_cwd_log(self):
> - os.chdir('/tmp')
> - cwd = os.getcwdu()
> + os.chdir(tempfile.mkdtemp())
> + cwd = getcwd()
> out, err = self.run_bzr('log', retcode=3)
>
> self.assertEqual(u'bzr: ERROR: Not a branch: %s/\n' % (cwd,),
This should change back out and remove the temporary directory in a
finally block.
> === modified file 'a/bzrlib/transport/local.py'
> --- a/bzrlib/transport/local.py
> +++ b/bzrlib/transport/local.py
> @@ -138,6 +138,8 @@
> fp = open(self.abspath(relpath), 'ab')
> except (IOError, OSError),e:
> self._translate_error(e, relpath)
> + # win32 workaround (tell on an unwritten file returns 0)
> + fp.seek(0, 2)
> result = fp.tell()
> self._pump(f, fp)
> return result
Thanks for putting the comment - very good idea otherwise someone
might remove it as redundant (on unix).
--
Martin Pool
More information about the bazaar
mailing list