/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

Merge Martins 0.15rc2 release branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    osutils,
27
27
    )
28
28
from bzrlib.memorytree import MemoryTree
29
 
from bzrlib.tests import TestCase, TestCaseWithTransport
 
29
from bzrlib.osutils import has_symlinks
 
30
from bzrlib.tests import (
 
31
        TestCase,
 
32
        TestCaseWithTransport,
 
33
        TestSkipped,
 
34
        )
30
35
 
31
36
 
32
37
# TODO:
684
689
    def test_add_symlink_to_root_no_parents_all_data(self):
685
690
        # The most trivial addition of a symlink when there are no parents and
686
691
        # its in the root and all data about the file is supplied
687
 
        ## TODO: windows: dont fail this test. Also, how are symlinks meant to
688
 
        # be represented on windows.
 
692
        # bzr doesn't support fake symlinks on windows, yet.
 
693
        if not has_symlinks():
 
694
            raise TestSkipped("No symlink support")
689
695
        os.symlink('target', 'a link')
690
696
        stat = os.lstat('a link')
691
697
        expected_entries = [
1201
1207
    def test_update_entry_symlink(self):
1202
1208
        """Update entry should read symlinks."""
1203
1209
        if not osutils.has_symlinks():
1204
 
            return # PlatformDeficiency / TestSkipped
 
1210
            # PlatformDeficiency / TestSkipped
 
1211
            raise TestSkipped("No symlink support")
1205
1212
        state, entry = self.get_state_with_a()
1206
1213
        state.save()
1207
1214
        self.assertEqual(dirstate.DirState.IN_MEMORY_UNMODIFIED,
1286
1293
        This should not be called if this platform does not have symlink
1287
1294
        support.
1288
1295
        """
 
1296
        # caller should care about skipping test on platforms without symlinks
1289
1297
        os.symlink('path/to/foo', 'a')
1290
1298
 
1291
1299
        stat_value = os.lstat('a')
1320
1328
 
1321
1329
    def test_update_missing_symlink(self):
1322
1330
        if not osutils.has_symlinks():
1323
 
            return # PlatformDeficiency / TestSkipped
 
1331
            # PlatformDeficiency / TestSkipped
 
1332
            raise TestSkipped("No symlink support")
1324
1333
        state, entry = self.get_state_with_a()
1325
1334
        packed_stat = self.create_and_test_symlink(state, entry)
1326
1335
        os.remove('a')
1341
1350
    def test_update_file_to_symlink(self):
1342
1351
        """File becomes a symlink"""
1343
1352
        if not osutils.has_symlinks():
1344
 
            return # PlatformDeficiency / TestSkipped
 
1353
            # PlatformDeficiency / TestSkipped
 
1354
            raise TestSkipped("No symlink support")
1345
1355
        state, entry = self.get_state_with_a()
1346
1356
        self.create_and_test_file(state, entry)
1347
1357
        os.remove('a')
1357
1367
    def test_update_dir_to_symlink(self):
1358
1368
        """Directory becomes a symlink"""
1359
1369
        if not osutils.has_symlinks():
1360
 
            return # PlatformDeficiency / TestSkipped
 
1370
            # PlatformDeficiency / TestSkipped
 
1371
            raise TestSkipped("No symlink support")
1361
1372
        state, entry = self.get_state_with_a()
1362
1373
        self.create_and_test_dir(state, entry)
1363
1374
        os.rmdir('a')
1365
1376
 
1366
1377
    def test_update_symlink_to_file(self):
1367
1378
        """Symlink becomes a file"""
 
1379
        if not has_symlinks():
 
1380
            raise TestSkipped("No symlink support")
1368
1381
        state, entry = self.get_state_with_a()
1369
1382
        self.create_and_test_symlink(state, entry)
1370
1383
        os.remove('a')
1372
1385
 
1373
1386
    def test_update_symlink_to_dir(self):
1374
1387
        """Symlink becomes a directory"""
 
1388
        if not has_symlinks():
 
1389
            raise TestSkipped("No symlink support")
1375
1390
        state, entry = self.get_state_with_a()
1376
1391
        self.create_and_test_symlink(state, entry)
1377
1392
        os.remove('a')