~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: Vincent Ladeuil
  • Date: 2016-02-01 18:09:18 UTC
  • mfrom: (6614.1.3 assert)
  • mto: This revision was merged to the branch mainline in revision 6615.
  • Revision ID: v.ladeuil+lp@free.fr-20160201180918-jqtq8ol6gdbbbtpv
Fix deprecated assertions to unblock release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2011 Canonical Ltd
 
1
# Copyright (C) 2006-2013, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
1032
1032
        bzrdir.BzrDirMetaFormat1.register_feature('bar')
1033
1033
        self.addCleanup(bzrdir.BzrDirMetaFormat1.unregister_feature, 'bar')
1034
1034
        dir = bzrdir.BzrDir.open('tree')
1035
 
        self.assertEquals("required", dir._format.features.get("bar"))
 
1035
        self.assertEqual("required", dir._format.features.get("bar"))
1036
1036
        tree.bzrdir.update_feature_flags({"bar": None, "nonexistant": None})
1037
1037
        dir = bzrdir.BzrDir.open('tree')
1038
 
        self.assertEquals({}, dir._format.features)
 
1038
        self.assertEqual({}, dir._format.features)
1039
1039
 
1040
1040
    def test_needs_conversion_different_working_tree(self):
1041
1041
        # meta1dirs need an conversion if any element is not the default.
1231
1231
            raise TestSkipped('unable to make file hidden without pywin32 library')
1232
1232
        b = bzrdir.BzrDir.create('.')
1233
1233
        self.build_tree(['a'])
1234
 
        self.assertEquals(['a'], self.get_ls())
 
1234
        self.assertEqual(['a'], self.get_ls())
1235
1235
 
1236
1236
    def test_dot_bzr_hidden_with_url(self):
1237
1237
        if sys.platform == 'win32' and not win32utils.has_win32file:
1238
1238
            raise TestSkipped('unable to make file hidden without pywin32 library')
1239
1239
        b = bzrdir.BzrDir.create(urlutils.local_path_to_url('.'))
1240
1240
        self.build_tree(['a'])
1241
 
        self.assertEquals(['a'], self.get_ls())
 
1241
        self.assertEqual(['a'], self.get_ls())
1242
1242
 
1243
1243
 
1244
1244
class _TestBzrDirFormat(bzrdir.BzrDirMetaFormat1):
1475
1475
    def test_as_string(self):
1476
1476
        format = SampleBzrFormat()
1477
1477
        format.features = {"foo": "required"}
1478
 
        self.assertEquals(format.as_string(),
 
1478
        self.assertEqual(format.as_string(),
1479
1479
            "First line\n"
1480
1480
            "required foo\n")
1481
1481
        format.features["another"] = "optional"
1482
 
        self.assertEquals(format.as_string(),
 
1482
        self.assertEqual(format.as_string(),
1483
1483
            "First line\n"
1484
1484
            "required foo\n"
1485
1485
            "optional another\n")
1488
1488
        # The network string should include the feature info
1489
1489
        format = SampleBzrFormat()
1490
1490
        format.features = {"foo": "required"}
1491
 
        self.assertEquals(
 
1491
        self.assertEqual(
1492
1492
            "First line\nrequired foo\n",
1493
1493
            format.network_name())
1494
1494
 
1496
1496
        # No features
1497
1497
        format = SampleBzrFormat.from_string(
1498
1498
            "First line\n")
1499
 
        self.assertEquals({}, format.features)
 
1499
        self.assertEqual({}, format.features)
1500
1500
 
1501
1501
    def test_from_string_with_feature(self):
1502
1502
        # Proper feature
1503
1503
        format = SampleBzrFormat.from_string(
1504
1504
            "First line\nrequired foo\n")
1505
 
        self.assertEquals("required", format.features.get("foo"))
 
1505
        self.assertEqual("required", format.features.get("foo"))
1506
1506
 
1507
1507
    def test_from_string_format_string_mismatch(self):
1508
1508
        # The first line has to match the format string
1518
1518
        # Feature with spaces (in case we add stuff like this in the future)
1519
1519
        format = SampleBzrFormat.from_string(
1520
1520
            "First line\nrequired foo with spaces\n")
1521
 
        self.assertEquals("required", format.features.get("foo with spaces"))
 
1521
        self.assertEqual("required", format.features.get("foo with spaces"))
1522
1522
 
1523
1523
    def test_eq(self):
1524
1524
        format1 = SampleBzrFormat()
1525
1525
        format1.features = {"nested-trees": "optional"}
1526
1526
        format2 = SampleBzrFormat()
1527
1527
        format2.features = {"nested-trees": "optional"}
1528
 
        self.assertEquals(format1, format1)
1529
 
        self.assertEquals(format1, format2)
 
1528
        self.assertEqual(format1, format1)
 
1529
        self.assertEqual(format1, format2)
1530
1530
        format3 = SampleBzrFormat()
1531
 
        self.assertNotEquals(format1, format3)
 
1531
        self.assertNotEqual(format1, format3)
1532
1532
 
1533
1533
    def test_check_support_status_optional(self):
1534
1534
        # Optional, so silently ignore