~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1201
1201
            raise AssertionError('pattern "%s" found in "%s"'
1202
1202
                    % (needle_re, haystack))
1203
1203
 
 
1204
    def assertContainsString(self, haystack, needle):
 
1205
        if haystack.find(needle) == -1:
 
1206
            self.fail("string %r not found in '''%s'''" % (needle, haystack))
 
1207
 
1204
1208
    def assertSubset(self, sublist, superlist):
1205
1209
        """Assert that every entry in sublist is present in superlist."""
1206
1210
        missing = set(sublist) - set(superlist)
1542
1546
            # use an env var so it propagates to subprocesses.
1543
1547
            'APPORT_DISABLE': '1',
1544
1548
        }
1545
 
        self.__old_env = {}
 
1549
        self._old_env = {}
1546
1550
        self.addCleanup(self._restoreEnvironment)
1547
1551
        for name, value in new_env.iteritems():
1548
1552
            self._captureVar(name, value)
1549
1553
 
1550
1554
    def _captureVar(self, name, newvalue):
1551
1555
        """Set an environment variable, and reset it when finished."""
1552
 
        self.__old_env[name] = osutils.set_or_unset_env(name, newvalue)
 
1556
        self._old_env[name] = osutils.set_or_unset_env(name, newvalue)
1553
1557
 
1554
1558
    def _restoreEnvironment(self):
1555
 
        for name, value in self.__old_env.iteritems():
 
1559
        for name, value in self._old_env.iteritems():
1556
1560
            osutils.set_or_unset_env(name, value)
1557
1561
 
1558
1562
    def _restoreHooks(self):
3658
3662
        'bzrlib.tests.test_identitymap',
3659
3663
        'bzrlib.tests.test_ignores',
3660
3664
        'bzrlib.tests.test_index',
 
3665
        'bzrlib.tests.test_import_tariff',
3661
3666
        'bzrlib.tests.test_info',
3662
3667
        'bzrlib.tests.test_inv',
3663
3668
        'bzrlib.tests.test_inventory_delta',