/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/blackbox/test_selftest.py

  • Committer: Vincent Ladeuil
  • Date: 2009-10-06 14:40:37 UTC
  • mto: (4728.1.2 integration)
  • mto: This revision was merged to the branch mainline in revision 4731.
  • Revision ID: v.ladeuil+lp@free.fr-20091006144037-o76rgosv9hj3td0y
Simplify mutable_tree.has_changes() and update call sites.

* bzrlib/workingtree.py:
(WorkingTree.merge_from_branch): Add a force parameter. Replace
the check_basis() call by the corresponding code, taken the new
'force' parameter into account.

* bzrlib/tests/test_status.py:
(TestStatus.make_multiple_pending_tree): Add force=True on
supplementary merges.

* bzrlib/tests/test_reconfigure.py:
(TestReconfigure): Add a test for pending merges.

* bzrlib/tests/test_msgeditor.py:
(MsgEditorTest.make_multiple_pending_tree): Add force=True on
supplementary merges.

* bzrlib/tests/blackbox/test_uncommit.py:
(TestUncommit.test_uncommit_octopus_merge): Add force=True on
supplementary merges.

* bzrlib/send.py:
(send): Use the simplified has_changes(). Fix typo in comment too.

* bzrlib/reconfigure.py:
(Reconfigure._check): Use the simplified has_changes().

* bzrlib/mutabletree.py:
(MutableTree.has_changes): Make the tree parameter optional but
retain it for tests. Add a pending merges check.

* bzrlib/merge.py:
(Merger.ensure_revision_trees, Merger.file_revisions,
Merger.check_basis, Merger.compare_basis): Deprecate.

* bzrlib/bundle/apply_bundle.py:
(merge_bundle): Replace the check_basis() call by the
corresponding code.

* bzrlib/builtins.py:
(cmd_remove_tree.run, cmd_push.run, cmd_merge.run): Use the
simplified has_changes().
(cmd_merge.run): Replace the check_basis call() by the corresponding
code (minus the alredy done has_changes() check).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2007 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
16
16
 
17
17
"""UI tests for the test framework."""
18
18
 
 
19
import bzrlib.transport
19
20
from bzrlib import (
20
21
    benchmarks,
21
22
    tests,
22
23
    )
 
24
from bzrlib.errors import ParamikoNotPresent
23
25
from bzrlib.tests import (
24
 
    features,
25
 
    )
26
 
from bzrlib.transport import memory
 
26
                          SubUnitFeature,
 
27
                          TestCase,
 
28
                          TestCaseInTempDir,
 
29
                          TestSkipped,
 
30
                          )
 
31
 
27
32
 
28
33
class SelfTestPatch:
29
34
 
46
51
            tests.selftest = original_selftest
47
52
 
48
53
 
49
 
class TestOptionsWritingToDisk(tests.TestCaseInTempDir, SelfTestPatch):
 
54
class TestOptionsWritingToDisk(TestCaseInTempDir, SelfTestPatch):
50
55
 
51
56
    def test_benchmark_runs_benchmark_tests(self):
52
57
        """selftest --benchmark should change the suite factory."""
64
69
        self.assertEqual(0, len(lines))
65
70
 
66
71
 
67
 
class TestOptions(tests.TestCase, SelfTestPatch):
 
72
class TestOptions(TestCase, SelfTestPatch):
68
73
 
69
74
    def test_load_list(self):
70
75
        params = self.get_params_passed_to_core('selftest --load-list foo')
73
78
    def test_transport_set_to_sftp(self):
74
79
        # Test that we can pass a transport to the selftest core - sftp
75
80
        # version.
76
 
        self.requireFeature(features.paramiko)
77
 
        from bzrlib.tests import stub_sftp
 
81
        try:
 
82
            import bzrlib.transport.sftp
 
83
        except ParamikoNotPresent:
 
84
            raise TestSkipped("Paramiko not present")
78
85
        params = self.get_params_passed_to_core('selftest --transport=sftp')
79
 
        self.assertEqual(stub_sftp.SFTPAbsoluteServer,
 
86
        self.assertEqual(bzrlib.transport.sftp.SFTPAbsoluteServer,
80
87
            params[1]["transport"])
81
88
 
82
89
    def test_transport_set_to_memory(self):
83
90
        # Test that we can pass a transport to the selftest core - memory
84
91
        # version.
 
92
        import bzrlib.transport.memory
85
93
        params = self.get_params_passed_to_core('selftest --transport=memory')
86
 
        self.assertEqual(memory.MemoryServer, params[1]["transport"])
 
94
        self.assertEqual(bzrlib.transport.memory.MemoryServer,
 
95
            params[1]["transport"])
87
96
 
88
97
    def test_parameters_passed_to_core(self):
89
98
        params = self.get_params_passed_to_core('selftest --list-only')
107
116
        self.assertEqual(['foo', 'bar'], params[1]['starting_with'])
108
117
 
109
118
    def test_subunit(self):
110
 
        self.requireFeature(features.subunit)
 
119
        self.requireFeature(SubUnitFeature)
111
120
        params = self.get_params_passed_to_core('selftest --subunit')
112
121
        self.assertEqual(tests.SubUnitBzrRunner, params[1]['runner_class'])
113
122