~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.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:
134
134
        # This should work everywhere
135
135
        self.create_file('a', 'something in a\n')
136
136
        self._fancy_rename('a', 'b')
137
 
        self.failIfExists('a')
138
 
        self.failUnlessExists('b')
 
137
        self.assertPathDoesNotExist('a')
 
138
        self.assertPathExists('b')
139
139
        self.check_file_contents('b', 'something in a\n')
140
140
 
141
141
        self.create_file('a', 'new something in a\n')
148
148
        self.create_file('target', 'data in target\n')
149
149
        self.assertRaises((IOError, OSError), self._fancy_rename,
150
150
                          'missingsource', 'target')
151
 
        self.failUnlessExists('target')
 
151
        self.assertPathExists('target')
152
152
        self.check_file_contents('target', 'data in target\n')
153
153
 
154
154
    def test_fancy_rename_fails_if_source_and_target_missing(self):
159
159
        # Rename should be semi-atomic on all platforms
160
160
        self.create_file('a', 'something in a\n')
161
161
        osutils.rename('a', 'b')
162
 
        self.failIfExists('a')
163
 
        self.failUnlessExists('b')
 
162
        self.assertPathDoesNotExist('a')
 
163
        self.assertPathExists('b')
164
164
        self.check_file_contents('b', 'something in a\n')
165
165
 
166
166
        self.create_file('a', 'new something in a\n')
267
267
 
268
268
        osutils.rmtree('dir')
269
269
 
270
 
        self.failIfExists('dir/file')
271
 
        self.failIfExists('dir')
 
270
        self.assertPathDoesNotExist('dir/file')
 
271
        self.assertPathDoesNotExist('dir')
272
272
 
273
273
 
274
274
class TestDeleteAny(tests.TestCaseInTempDir):
924
924
        b.close()
925
925
 
926
926
        osutils._win32_rename('b', 'a')
927
 
        self.failUnlessExists('a')
928
 
        self.failIfExists('b')
 
927
        self.assertPathExists('a')
 
928
        self.assertPathDoesNotExist('b')
929
929
        self.assertFileEqual('baz\n', 'a')
930
930
 
931
931
    def test_rename_missing_file(self):
1614
1614
                          ('d', 'source/b', 'target/b'),
1615
1615
                          ('f', 'source/b/c', 'target/b/c'),
1616
1616
                         ], processed_files)
1617
 
        self.failIfExists('target')
 
1617
        self.assertPathDoesNotExist('target')
1618
1618
        if osutils.has_symlinks():
1619
1619
            self.assertEqual([('source/lnk', 'target/lnk')], processed_links)
1620
1620