[Pkg-bazaar-commits] ./bzr/unstable r775: - New helper TestBase.check_file_contents

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:21:00 UTC 2009


------------------------------------------------------------
revno: 775
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Fri 2005-06-24 19:38:25 +1000
message:
  - New helper TestBase.check_file_contents
modified:
  bzrlib/selftest/__init__.py
-------------- next part --------------
=== modified file 'bzrlib/selftest/__init__.py'
--- a/bzrlib/selftest/__init__.py	2005-06-24 09:22:51 +0000
+++ b/bzrlib/selftest/__init__.py	2005-06-24 09:38:25 +0000
@@ -139,11 +139,21 @@
             else:
                 extras.append(name)
         if shape:
-            self.fail("expcted paths not found in inventory: %r" % shape)
+            self.fail("expected paths not found in inventory: %r" % shape)
         if extras:
             self.fail("unexpected paths found in inventory: %r" % extras)
 
 
+    def check_file_contents(self, filename, expect):
+        self.log("check contents of file %s" % filename)
+        contents = file(filename, 'r').read()
+        if contents != expect:
+            self.log("expected: %r" % expected)
+            self.log("actually: %r" % contents)
+            self.fail("contents of %s not as expected")
+            
+
+
 class InTempDir(TestBase):
     """Base class for tests run in a temporary branch."""
     def setUp(self):



More information about the Pkg-bazaar-commits mailing list