~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-16 01:09:56 UTC
  • mfrom: (5784.1.4 760435-less-fail)
  • Revision ID: pqm@pqm.ubuntu.com-20110416010956-5wrpm136qq2hz5f3
(mbp) rename and deprecate failUnlessExists and failIfExists (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
 
107
107
        filename = u'hell\u00d8'
108
108
        self.build_tree_contents([(filename, 'contents of hello')])
109
 
        self.failUnlessExists(filename)
 
109
        self.assertPathExists(filename)
110
110
 
111
111
 
112
112
class TestClassesAvailable(tests.TestCase):
510
510
        self.assertRaises(AssertionError, self.assertEqualStat,
511
511
            os.lstat("foo"), os.lstat("longname"))
512
512
 
 
513
    def test_failUnlessExists(self):
 
514
        """Deprecated failUnlessExists and failIfExists"""
 
515
        self.applyDeprecated(
 
516
            deprecated_in((2, 4)),
 
517
            self.failUnlessExists, '.')
 
518
        self.build_tree(['foo/', 'foo/bar'])
 
519
        self.applyDeprecated(
 
520
            deprecated_in((2, 4)),
 
521
            self.failUnlessExists, 'foo/bar')
 
522
        self.applyDeprecated(
 
523
            deprecated_in((2, 4)),
 
524
            self.failIfExists, 'foo/foo')
 
525
 
 
526
    def test_assertPathExists(self):
 
527
        self.assertPathExists('.')
 
528
        self.build_tree(['foo/', 'foo/bar'])
 
529
        self.assertPathExists('foo/bar')
 
530
        self.assertPathDoesNotExist('foo/foo')
 
531
 
513
532
 
514
533
class TestTestCaseWithMemoryTransport(tests.TestCaseWithMemoryTransport):
515
534
 
662
681
    def test_make_branch_builder(self):
663
682
        builder = self.make_branch_builder('dir')
664
683
        rev_id = builder.build_commit()
665
 
        self.failUnlessExists('dir')
 
684
        self.assertPathExists('dir')
666
685
        a_dir = bzrdir.BzrDir.open('dir')
667
686
        self.assertRaises(errors.NoWorkingTree, a_dir.open_workingtree)
668
687
        a_branch = a_dir.open_branch()
684
703
        self.assertIsInstance(result_bzrdir.transport,
685
704
                              memory.MemoryTransport)
686
705
        # should not be on disk, should only be in memory
687
 
        self.failIfExists('subdir')
 
706
        self.assertPathDoesNotExist('subdir')
688
707
 
689
708
 
690
709
class TestChrootedTest(tests.ChrootedTestCase):