/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

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
577
577
            self.fail("%r is an instance of %s rather than %s" % (
578
578
                obj, obj.__class__, kls))
579
579
 
580
 
    def assertDeprecated(self, expected, callable, *args, **kwargs):
 
580
    def callDeprecated(self, expected, callable, *args, **kwargs):
581
581
        """Assert that a callable is deprecated in a particular way.
582
582
 
583
583
        :param expected: a list of the deprecation warnings expected, in order
592
592
        method = symbol_versioning.warn
593
593
        symbol_versioning.set_warning_method(capture_warnings)
594
594
        try:
595
 
            callable(*args, **kwargs)
 
595
            result = callable(*args, **kwargs)
596
596
        finally:
597
 
            result = symbol_versioning.set_warning_method(method)
 
597
            symbol_versioning.set_warning_method(method)
598
598
        self.assertEqual(expected, local_warnings)
599
599
        return result
600
600
 
604
604
        The file is removed as the test is torn down.
605
605
        """
606
606
        fileno, name = tempfile.mkstemp(suffix='.log', prefix='testbzr')
607
 
        encoder, decoder, stream_reader, stream_writer = codecs.lookup('UTF-8')
608
 
        self._log_file = stream_writer(os.fdopen(fileno, 'w+'))
 
607
        self._log_file = os.fdopen(fileno, 'w+')
609
608
        self._log_nonce = bzrlib.trace.enable_test_log(self._log_file)
610
609
        self._log_file_name = name
611
610
        self.addCleanup(self._finishLogFile)
799
798
        return self.run_bzr_captured(args, retcode=retcode, encoding=encoding, stdin=stdin)
800
799
 
801
800
    def run_bzr_decode(self, *args, **kwargs):
802
 
        if kwargs.has_key('encoding'):
 
801
        if 'encoding' in kwargs:
803
802
            encoding = kwargs['encoding']
804
803
        else:
805
804
            encoding = bzrlib.user_encoding
844
843
        profiled or debugged so easily.
845
844
 
846
845
        :param retcode: The status code that is expected.  Defaults to 0.  If
847
 
        None is supplied, the status code is not checked.
 
846
            None is supplied, the status code is not checked.
 
847
        :param env_changes: A dictionary which lists changes to environment
 
848
            variables. A value of None will unset the env variable.
 
849
            The values must be strings. The change will only occur in the
 
850
            child, so you don't need to fix the environment after running.
848
851
        """
 
852
        env_changes = kwargs.get('env_changes', {})
 
853
        def cleanup_environment():
 
854
            for env_var, value in env_changes.iteritems():
 
855
                if value is None:
 
856
                    del os.environ[env_var]
 
857
                else:
 
858
                    os.environ[env_var] = value
 
859
 
849
860
        bzr_path = os.path.dirname(os.path.dirname(bzrlib.__file__))+'/bzr'
850
861
        args = list(args)
851
 
        process = Popen([sys.executable, bzr_path]+args, stdout=PIPE, 
852
 
                         stderr=PIPE)
 
862
        process = Popen([sys.executable, bzr_path]+args,
 
863
                         stdout=PIPE, stderr=PIPE,
 
864
                         preexec_fn=cleanup_environment)
853
865
        out = process.stdout.read()
854
866
        err = process.stderr.read()
855
867
        retcode = process.wait()
921
933
        base_rev = common_ancestor(branch_from.last_revision(),
922
934
                                   wt_to.branch.last_revision(),
923
935
                                   wt_to.branch.repository)
924
 
        merge_inner(wt_to.branch, branch_from.basis_tree(), 
 
936
        merge_inner(wt_to.branch, branch_from.basis_tree(),
925
937
                    wt_to.branch.repository.revision_tree(base_rev),
926
938
                    this_tree=wt_to)
927
 
        wt_to.add_pending_merge(branch_from.last_revision())
 
939
        wt_to.add_parent_tree_id(branch_from.last_revision())
928
940
 
929
941
 
930
942
BzrTestBase = TestCase
1362
1374
                   'bzrlib.tests.test_progress',
1363
1375
                   'bzrlib.tests.test_reconcile',
1364
1376
                   'bzrlib.tests.test_repository',
 
1377
                   'bzrlib.tests.test_revert',
1365
1378
                   'bzrlib.tests.test_revision',
1366
1379
                   'bzrlib.tests.test_revisionnamespaces',
1367
1380
                   'bzrlib.tests.test_revisiontree',
1370
1383
                   'bzrlib.tests.test_selftest',
1371
1384
                   'bzrlib.tests.test_setup',
1372
1385
                   'bzrlib.tests.test_sftp_transport',
 
1386
                   'bzrlib.tests.test_ftp_transport',
1373
1387
                   'bzrlib.tests.test_smart_add',
1374
1388
                   'bzrlib.tests.test_source',
1375
1389
                   'bzrlib.tests.test_status',