/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/__init__.py

  • Committer: Carl Friedrich Bolz
  • Date: 2006-09-06 21:17:22 UTC
  • mfrom: (1977 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2026.
  • Revision ID: cfbolz@gmx.de-20060906211722-b04f9c3ad1f53ef1
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
580
580
            self.fail("%r is an instance of %s rather than %s" % (
581
581
                obj, obj.__class__, kls))
582
582
 
583
 
    def assertDeprecated(self, expected, callable, *args, **kwargs):
 
583
    def callDeprecated(self, expected, callable, *args, **kwargs):
584
584
        """Assert that a callable is deprecated in a particular way.
585
585
 
586
586
        :param expected: a list of the deprecation warnings expected, in order
595
595
        method = symbol_versioning.warn
596
596
        symbol_versioning.set_warning_method(capture_warnings)
597
597
        try:
598
 
            callable(*args, **kwargs)
 
598
            result = callable(*args, **kwargs)
599
599
        finally:
600
 
            result = symbol_versioning.set_warning_method(method)
 
600
            symbol_versioning.set_warning_method(method)
601
601
        self.assertEqual(expected, local_warnings)
602
602
        return result
603
603
 
607
607
        The file is removed as the test is torn down.
608
608
        """
609
609
        fileno, name = tempfile.mkstemp(suffix='.log', prefix='testbzr')
610
 
        encoder, decoder, stream_reader, stream_writer = codecs.lookup('UTF-8')
611
 
        self._log_file = stream_writer(os.fdopen(fileno, 'w+'))
 
610
        self._log_file = os.fdopen(fileno, 'w+')
612
611
        self._log_nonce = bzrlib.trace.enable_test_log(self._log_file)
613
612
        self._log_file_name = name
614
613
        self.addCleanup(self._finishLogFile)
820
819
        return self.run_bzr_captured(args, retcode=retcode, encoding=encoding, stdin=stdin)
821
820
 
822
821
    def run_bzr_decode(self, *args, **kwargs):
823
 
        if kwargs.has_key('encoding'):
 
822
        if 'encoding' in kwargs:
824
823
            encoding = kwargs['encoding']
825
824
        else:
826
825
            encoding = bzrlib.user_encoding
865
864
        profiled or debugged so easily.
866
865
 
867
866
        :param retcode: The status code that is expected.  Defaults to 0.  If
868
 
        None is supplied, the status code is not checked.
 
867
            None is supplied, the status code is not checked.
 
868
        :param env_changes: A dictionary which lists changes to environment
 
869
            variables. A value of None will unset the env variable.
 
870
            The values must be strings. The change will only occur in the
 
871
            child, so you don't need to fix the environment after running.
869
872
        """
 
873
        env_changes = kwargs.get('env_changes', {})
 
874
        def cleanup_environment():
 
875
            for env_var, value in env_changes.iteritems():
 
876
                if value is None:
 
877
                    del os.environ[env_var]
 
878
                else:
 
879
                    os.environ[env_var] = value
 
880
 
870
881
        bzr_path = os.path.dirname(os.path.dirname(bzrlib.__file__))+'/bzr'
871
882
        args = list(args)
872
 
        process = Popen([sys.executable, bzr_path]+args, stdout=PIPE, 
873
 
                         stderr=PIPE)
 
883
        process = Popen([sys.executable, bzr_path]+args,
 
884
                         stdout=PIPE, stderr=PIPE,
 
885
                         preexec_fn=cleanup_environment)
874
886
        out = process.stdout.read()
875
887
        err = process.stderr.read()
876
888
        retcode = process.wait()
942
954
        base_rev = common_ancestor(branch_from.last_revision(),
943
955
                                   wt_to.branch.last_revision(),
944
956
                                   wt_to.branch.repository)
945
 
        merge_inner(wt_to.branch, branch_from.basis_tree(), 
 
957
        merge_inner(wt_to.branch, branch_from.basis_tree(),
946
958
                    wt_to.branch.repository.revision_tree(base_rev),
947
959
                    this_tree=wt_to)
948
 
        wt_to.add_pending_merge(branch_from.last_revision())
 
960
        wt_to.add_parent_tree_id(branch_from.last_revision())
949
961
 
950
962
 
951
963
BzrTestBase = TestCase
1383
1395
                   'bzrlib.tests.test_progress',
1384
1396
                   'bzrlib.tests.test_reconcile',
1385
1397
                   'bzrlib.tests.test_repository',
 
1398
                   'bzrlib.tests.test_revert',
1386
1399
                   'bzrlib.tests.test_revision',
1387
1400
                   'bzrlib.tests.test_revisionnamespaces',
1388
1401
                   'bzrlib.tests.test_revisiontree',
1391
1404
                   'bzrlib.tests.test_selftest',
1392
1405
                   'bzrlib.tests.test_setup',
1393
1406
                   'bzrlib.tests.test_sftp_transport',
 
1407
                   'bzrlib.tests.test_ftp_transport',
1394
1408
                   'bzrlib.tests.test_smart_add',
1395
1409
                   'bzrlib.tests.test_source',
1396
1410
                   'bzrlib.tests.test_status',