~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Robey Pointer
  • Date: 2006-09-03 00:28:18 UTC
  • mfrom: (1981 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1996.
  • Revision ID: robey@lag.net-20060903002818-71ca5c7bfea93a26
merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
import bzrlib.plugin
64
64
import bzrlib.progress as progress
65
65
from bzrlib.revision import common_ancestor
66
 
from bzrlib.revisionspec import RevisionSpec
67
66
import bzrlib.store
68
67
from bzrlib import symbol_versioning
69
68
import bzrlib.trace
843
842
        profiled or debugged so easily.
844
843
 
845
844
        :param retcode: The status code that is expected.  Defaults to 0.  If
846
 
        None is supplied, the status code is not checked.
 
845
            None is supplied, the status code is not checked.
 
846
        :param env_changes: A dictionary which lists changes to environment
 
847
            variables. A value of None will unset the env variable.
 
848
            The values must be strings. The change will only occur in the
 
849
            child, so you don't need to fix the environment after running.
847
850
        """
 
851
        env_changes = kwargs.get('env_changes', {})
 
852
        def cleanup_environment():
 
853
            for env_var, value in env_changes.iteritems():
 
854
                if value is None:
 
855
                    del os.environ[env_var]
 
856
                else:
 
857
                    os.environ[env_var] = value
 
858
 
848
859
        bzr_path = os.path.dirname(os.path.dirname(bzrlib.__file__))+'/bzr'
849
860
        args = list(args)
850
 
        process = Popen([sys.executable, bzr_path]+args, stdout=PIPE, 
851
 
                         stderr=PIPE)
 
861
        process = Popen([sys.executable, bzr_path]+args,
 
862
                         stdout=PIPE, stderr=PIPE,
 
863
                         preexec_fn=cleanup_environment)
852
864
        out = process.stdout.read()
853
865
        err = process.stderr.read()
854
866
        retcode = process.wait()
920
932
        base_rev = common_ancestor(branch_from.last_revision(),
921
933
                                   wt_to.branch.last_revision(),
922
934
                                   wt_to.branch.repository)
923
 
        merge_inner(wt_to.branch, branch_from.basis_tree(), 
 
935
        merge_inner(wt_to.branch, branch_from.basis_tree(),
924
936
                    wt_to.branch.repository.revision_tree(base_rev),
925
937
                    this_tree=wt_to)
926
 
        wt_to.add_pending_merge(branch_from.last_revision())
 
938
        wt_to.add_parent_tree_id(branch_from.last_revision())
927
939
 
928
940
 
929
941
BzrTestBase = TestCase
1361
1373
                   'bzrlib.tests.test_progress',
1362
1374
                   'bzrlib.tests.test_reconcile',
1363
1375
                   'bzrlib.tests.test_repository',
 
1376
                   'bzrlib.tests.test_revert',
1364
1377
                   'bzrlib.tests.test_revision',
1365
1378
                   'bzrlib.tests.test_revisionnamespaces',
1366
1379
                   'bzrlib.tests.test_revisiontree',