~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

  • Committer: Robert Collins
  • Date: 2005-10-18 12:07:55 UTC
  • mto: This revision was merged to the branch mainline in revision 1463.
  • Revision ID: robertc@robertcollins.net-20051018120755-dff7965f9c6f9ee8
Add assertFileEqual to TestCaseInTempDir.

There is a new method for TestCaseInTempDir, assertFileEqual, which
will check that a given content is equal to the content of the named
file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
205
205
        if not re.search(needle_re, haystack):
206
206
            raise AssertionError('pattern "%s" not found in "%s"'
207
207
                    % (needle_re, haystack))
208
 
        
 
208
 
209
209
    def _enable_file_logging(self):
210
210
        fileno, name = tempfile.mkstemp(suffix='.log', prefix='testbzr')
211
211
 
449
449
        """Fail unless path, which may be abs or relative, exists."""
450
450
        self.failUnless(osutils.lexists(path))
451
451
        
 
452
    def assertFileEqual(self, content, path):
 
453
        """Fail if path does not contain 'content'."""
 
454
        self.failUnless(osutils.lexists(path))
 
455
        self.assertEqualDiff(content, open(path, 'r').read())
 
456
        
452
457
 
453
458
class MetaTestLog(TestCase):
454
459
    def test_logging(self):