~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_switch.py

  • Committer: Martin Pool
  • Date: 2011-04-15 07:01:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5789.
  • Revision ID: mbp@sourcefrog.net-20110415070122-7x24skeadcm7wvut
Switch away from using failUnlessExists and failIfExists

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
            lightweight=self.lightweight)
54
54
        self.build_tree(['checkout/file-3'])
55
55
        checkout.add('file-3')
56
 
        self.failIfExists('checkout/file-1')
57
 
        self.failUnlessExists('checkout/file-2')
 
56
        self.assertPathDoesNotExist('checkout/file-1')
 
57
        self.assertPathExists('checkout/file-2')
58
58
        switch.switch(checkout.bzrdir, to_branch)
59
 
        self.failUnlessExists('checkout/file-1')
60
 
        self.failIfExists('checkout/file-2')
61
 
        self.failUnlessExists('checkout/file-3')
 
59
        self.assertPathExists('checkout/file-1')
 
60
        self.assertPathDoesNotExist('checkout/file-2')
 
61
        self.assertPathExists('checkout/file-3')
62
62
 
63
63
    def test_switch_after_branch_moved(self):
64
64
        """Test switch after the branch is moved."""
84
84
                'Unable to connect to current master branch .*'
85
85
                'To switch anyway, use --force.')
86
86
        switch.switch(checkout.bzrdir, to_branch, force=True)
87
 
        self.failIfExists('checkout/file-1')
88
 
        self.failUnlessExists('checkout/file-2')
89
 
        self.failUnlessExists('checkout/file-3')
 
87
        self.assertPathDoesNotExist('checkout/file-1')
 
88
        self.assertPathExists('checkout/file-2')
 
89
        self.assertPathExists('checkout/file-3')
90
90
 
91
91
    def test_switch_when_pending_merges(self):
92
92
        """Test graceful failure if pending merges are outstanding."""
120
120
        checkout = tree.branch.create_checkout('checkout',
121
121
            lightweight=self.lightweight)
122
122
        switch.switch(checkout.bzrdir, tree.branch, revision_id="rev1")
123
 
        self.failUnlessExists('checkout/file-1')
124
 
        self.failIfExists('checkout/file-2')
 
123
        self.assertPathExists('checkout/file-1')
 
124
        self.assertPathDoesNotExist('checkout/file-2')
125
125
 
126
126
    def test_switch_changing_root_id(self):
127
127
        tree = self._setup_tree()
179
179
        self.assertContainsRe(str(err),
180
180
            'Cannot switch as local commits found in the checkout.')
181
181
        # Check all is ok when force is given
182
 
        self.failIfExists('checkout/file-1')
183
 
        self.failUnlessExists('checkout/file-2')
 
182
        self.assertPathDoesNotExist('checkout/file-1')
 
183
        self.assertPathExists('checkout/file-2')
184
184
        switch.switch(checkout.bzrdir, to_branch, force=True)
185
 
        self.failUnlessExists('checkout/file-1')
186
 
        self.failIfExists('checkout/file-2')
187
 
        self.failIfExists('checkout/file-3')
188
 
        self.failUnlessExists('checkout/file-4')
 
185
        self.assertPathExists('checkout/file-1')
 
186
        self.assertPathDoesNotExist('checkout/file-2')
 
187
        self.assertPathDoesNotExist('checkout/file-3')
 
188
        self.assertPathExists('checkout/file-4')
189
189
        # Check that the checkout is a true mirror of the bound branch
190
190
        self.assertEqual(to_branch.last_revision_info(),
191
191
                         checkout.branch.last_revision_info())