I need an additional test change, like this, for the path_content_summary tests:
=== modified file 'bzrlib/tests/per_tree/test_path_content_summary.py'
--- bzrlib/tests/per_tree/test_path_content_summary.py 2009-07-10 07:14:02 +0000
+++ bzrlib/tests/per_tree/test_path_content_summary.py 2009-08-25 05:55:44 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 Canonical Ltd
+# Copyright (C) 2007, 2009 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,6 +34,18 @@ self.addCleanup(result.unlock)
return result
+ def check_content_summary_size(self, tree, summary, expected_size):
+ # if the tree supports content filters, then it's allowed to leave out
+ # the size because it might be difficult to compute. otherwise, it
+ # must be present and correct
+ returned_size = summary[1]
+ if returned_size == expected_size or (
+ tree.supports_content_filtering()
+ and returned_size is None):
+ pass
+ else:
+ self.fail("invalid size in summary: %r" % (returned_size,))
+
def test_symlink_content_summary(self): self.requireFeature(tests.SymlinkFeature)
tree = self.make_branch_and_tree('tree')
@@ -76,8 +88,7 @@
summary = self._convert_tree(tree).path_content_summary('path') self.assertEqual(4, len(summary)) self.assertEqual('file', summary[0])
- # size must be known
- self.assertEqual(22, summary[1])
+ self.check_content_summary_size(tree, summary, 22)
# executable self.assertEqual(True, summary[2])
# may have hash,
@@ -91,8 +102,7 @@
summary = self._convert_tree(tree).path_content_summary('path') self.assertEqual(4, len(summary)) self.assertEqual('file', summary[0])
- # size must be known
- self.assertEqual(22, summary[1])
+ self.check_content_summary_size(tree, summary, 22)
# not executable
if osutils.supports_executable: self.assertEqual(False, summary[2])
I need an additional test change, like this, for the path_content_ summary tests:
=== modified file 'bzrlib/ tests/per_ tree/test_ path_content_ summary. py' tests/per_ tree/test_ path_content_ summary. py 2009-07-10 07:14:02 +0000 tests/per_ tree/test_ path_content_ summary. py 2009-08-25 05:55:44 +0000
self. addCleanup( result. unlock)
--- bzrlib/
+++ bzrlib/
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 Canonical Ltd
+# Copyright (C) 2007, 2009 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,6 +34,18 @@
return result
+ def check_content_ summary_ size(self, tree, summary, expected_size): content_ filtering( ) content_ summary( self):
self. requireFeature( tests.SymlinkFe ature) branch_ and_tree( 'tree') tree(tree) .path_content_ summary( 'path')
self. assertEqual( 4, len(summary))
self. assertEqual( 'file', summary[0]) l(22, summary[1]) content_ summary_ size(tree, summary, 22)
self. assertEqual( True, summary[2]) tree(tree) .path_content_ summary( 'path')
self. assertEqual( 4, len(summary))
self. assertEqual( 'file', summary[0]) l(22, summary[1]) content_ summary_ size(tree, summary, 22) supports_ executable:
self. assertEqual( False, summary[2])
+ # if the tree supports content filters, then it's allowed to leave out
+ # the size because it might be difficult to compute. otherwise, it
+ # must be present and correct
+ returned_size = summary[1]
+ if returned_size == expected_size or (
+ tree.supports_
+ and returned_size is None):
+ pass
+ else:
+ self.fail("invalid size in summary: %r" % (returned_size,))
+
def test_symlink_
tree = self.make_
@@ -76,8 +88,7 @@
summary = self._convert_
- # size must be known
- self.assertEqua
+ self.check_
# executable
# may have hash,
@@ -91,8 +102,7 @@
summary = self._convert_
- # size must be known
- self.assertEqua
+ self.check_
# not executable
if osutils.