Rev 4810: (jam) Last few tweaks to get the win32 test suite to pass. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Nov 18 22:03:04 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4810 [merge]
revision-id: pqm at pqm.ubuntu.com-20091118220300-jh43xy7xqftziwql
parent: pqm at pqm.ubuntu.com-20091118190447-5ey1wyx4v5c962uk
parent: john at arbash-meinel.com-20091118211532-9ao2qvswgq3ch22m
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-11-18 22:03:00 +0000
message:
(jam) Last few tweaks to get the win32 test suite to pass.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/per_tree/test_get_file_with_stat.py test_get_file_with_s-20080922035909-lhdovrr36jpxmu0v-1
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
=== modified file 'NEWS'
--- a/NEWS 2009-11-18 17:54:26 +0000
+++ b/NEWS 2009-11-18 22:03:00 +0000
@@ -35,8 +35,7 @@
* ``bzr mv --quiet`` really is quiet now. (Gordon Tyler, #271790)
* Lots of bugfixes for the test suite on Windows. We should once again
- have a test suite with no failures on Windows. (Once all the patches
- have landed, remove this line.) (John Arbash Meinel)
+ have a test suite with no failures on Windows. (John Arbash Meinel)
Improvements
************
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2009-11-16 19:56:24 +0000
+++ b/bzrlib/tests/__init__.py 2009-11-18 16:10:18 +0000
@@ -1115,12 +1115,23 @@
:raises AssertionError: If the expected and actual stat values differ
other than by atime.
"""
- self.assertEqual(expected.st_size, actual.st_size)
- self.assertEqual(expected.st_mtime, actual.st_mtime)
- self.assertEqual(expected.st_ctime, actual.st_ctime)
- self.assertEqual(expected.st_dev, actual.st_dev)
- self.assertEqual(expected.st_ino, actual.st_ino)
- self.assertEqual(expected.st_mode, actual.st_mode)
+ self.assertEqual(expected.st_size, actual.st_size,
+ 'st_size did not match')
+ self.assertEqual(expected.st_mtime, actual.st_mtime,
+ 'st_mtime did not match')
+ self.assertEqual(expected.st_ctime, actual.st_ctime,
+ 'st_ctime did not match')
+ if sys.platform != 'win32':
+ # On Win32 both 'dev' and 'ino' cannot be trusted. In python2.4 it
+ # is 'dev' that varies, in python 2.5 (6?) it is st_ino that is
+ # odd. Regardless we shouldn't actually try to assert anything
+ # about their values
+ self.assertEqual(expected.st_dev, actual.st_dev,
+ 'st_dev did not match')
+ self.assertEqual(expected.st_ino, actual.st_ino,
+ 'st_ino did not match')
+ self.assertEqual(expected.st_mode, actual.st_mode,
+ 'st_mode did not match')
def assertLength(self, length, obj_with_len):
"""Assert that obj_with_len is of length length."""
=== modified file 'bzrlib/tests/per_tree/test_get_file_with_stat.py'
--- a/bzrlib/tests/per_tree/test_get_file_with_stat.py 2009-07-10 07:14:02 +0000
+++ b/bzrlib/tests/per_tree/test_get_file_with_stat.py 2009-11-18 15:47:16 +0000
@@ -21,6 +21,7 @@
from bzrlib.tests.per_tree import TestCaseWithTree
+
class TestGetFileWithStat(TestCaseWithTree):
def test_get_file_with_stat_id_only(self):
@@ -31,6 +32,7 @@
tree.lock_read()
self.addCleanup(tree.unlock)
file_obj, statvalue = tree.get_file_with_stat('foo-id')
+ self.addCleanup(file_obj.close)
if statvalue is not None:
expected = os.lstat('foo')
self.assertEqualStat(expected, statvalue)
@@ -44,7 +46,7 @@
tree.lock_read()
self.addCleanup(tree.unlock)
file_obj, statvalue = tree.get_file_with_stat('foo-id', 'foo')
- expected = os.lstat('foo')
+ self.addCleanup(file_obj.close)
if statvalue is not None:
expected = os.lstat('foo')
self.assertEqualStat(expected, statvalue)
=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py 2009-11-10 07:01:56 +0000
+++ b/bzrlib/tests/test_osutils.py 2009-11-18 16:10:18 +0000
@@ -58,10 +58,6 @@
return s
-def _fs_enc_to_unicode(s):
- return s.decode(osutils._fs_enc)
-
-
def _utf8_to_unicode(s):
return s.decode('UTF-8')
@@ -87,12 +83,10 @@
if test__walkdirs_win32.Win32ReadDirFeature.available():
try:
from bzrlib import _walkdirs_win32
- # TODO: check on windows, it may be that we need to use/add
- # safe_unicode instead of _fs_enc_to_unicode
scenarios.append(
('win32',
dict(_dir_reader_class=_walkdirs_win32.Win32ReadDir,
- _native_to_unicode=_fs_enc_to_unicode)))
+ _native_to_unicode=_already_unicode)))
except ImportError:
pass
return scenarios
@@ -1631,7 +1625,7 @@
text = 'test\r\nwith\nall\rpossible line endings\r\n'
self.build_tree_contents([('foo', text)])
expected_sha = osutils.sha_string(text)
- f = open('foo')
+ f = open('foo', 'rb')
self.addCleanup(f.close)
size, sha = osutils.size_sha_file(f)
self.assertEqual(38, size)
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py 2009-09-15 01:52:34 +0000
+++ b/bzrlib/tests/test_repository.py 2009-11-08 23:59:07 +0000
@@ -24,6 +24,7 @@
from stat import S_ISDIR
from StringIO import StringIO
+import sys
import bzrlib
from bzrlib.errors import (NotBranchError,
@@ -252,7 +253,14 @@
tree = control.create_workingtree()
tree.add(['foo'], ['Foo:Bar'], ['file'])
tree.put_file_bytes_non_atomic('Foo:Bar', 'content\n')
- tree.commit('first post', rev_id='first')
+ try:
+ tree.commit('first post', rev_id='first')
+ except errors.IllegalPath:
+ if sys.platform != 'win32':
+ raise
+ self.knownFailure('Foo:Bar cannot be used as a file-id on windows'
+ ' in repo format 7')
+ return
self.assertEqualDiff(
'# bzr weave file v5\n'
'i\n'
=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py 2009-11-01 05:41:57 +0000
+++ b/bzrlib/tests/test_selftest.py 2009-11-08 04:44:23 +0000
@@ -490,9 +490,9 @@
self.assertEqualStat(real, fake)
def test_assertEqualStat_notequal(self):
- self.build_tree(["foo", "bar"])
+ self.build_tree(["foo", "longname"])
self.assertRaises(AssertionError, self.assertEqualStat,
- os.lstat("foo"), os.lstat("bar"))
+ os.lstat("foo"), os.lstat("longname"))
class TestTestCaseWithMemoryTransport(tests.TestCaseWithMemoryTransport):
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py 2009-11-10 19:40:13 +0000
+++ b/bzrlib/tests/test_transform.py 2009-11-18 16:10:18 +0000
@@ -1951,14 +1951,16 @@
branch, tt = self.get_branch_and_transform()
tt.new_file('file', tt.root, 'contents', 'file-id')
trans_id = tt.new_directory('dir', tt.root, 'dir-id')
- tt.new_symlink('symlink', trans_id, 'target', 'symlink-id')
+ if SymlinkFeature.available():
+ tt.new_symlink('symlink', trans_id, 'target', 'symlink-id')
rev = tt.commit(branch, 'message')
tree = branch.basis_tree()
self.assertEqual('file', tree.id2path('file-id'))
self.assertEqual('contents', tree.get_file_text('file-id'))
self.assertEqual('dir', tree.id2path('dir-id'))
- self.assertEqual('dir/symlink', tree.id2path('symlink-id'))
- self.assertEqual('target', tree.get_symlink_target('symlink-id'))
+ if SymlinkFeature.available():
+ self.assertEqual('dir/symlink', tree.id2path('symlink-id'))
+ self.assertEqual('target', tree.get_symlink_target('symlink-id'))
def test_add_unversioned(self):
branch, tt = self.get_branch_and_transform()
@@ -2454,8 +2456,6 @@
self.assertEqual(('missing', None, None, None), summary)
def test_file_content_summary_executable(self):
- if not osutils.supports_executable():
- raise TestNotApplicable()
preview = self.get_empty_preview()
path_id = preview.new_file('path', preview.root, 'contents', 'path-id')
preview.set_executability(True, path_id)
@@ -2754,6 +2754,7 @@
branch = self.make_branch('any')
tree = branch.repository.revision_tree(_mod_revision.NULL_REVISION)
tt = TransformPreview(tree)
+ self.addCleanup(tt.finalize)
foo_id = tt.new_directory('', ROOT_PARENT)
bar_id = tt.new_file(u'\u1234bar', foo_id, 'contents')
limbo_path = tt._limbo_name(bar_id)
More information about the bazaar-commits
mailing list