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

  • Committer: Andrew Bennetts
  • Date: 2008-08-12 14:53:26 UTC
  • mto: This revision was merged to the branch mainline in revision 3624.
  • Revision ID: andrew.bennetts@canonical.com-20080812145326-yx693x2jc4rcovb7
Move the notes on writing tests out of HACKING into a new file, and improve
them.

Many of the testing notes in the HACKING file were in duplicated in two places
in that file!  This change removes that duplication.  It also adds new sections
on “Where should I put a new test?” and “TestCase and its subclasses”, and
others like “Test feature dependencies” have been expanded.  The whole document
has generally been edited to be a bit more coherent. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Tests for Tree and InterTree."""
18
18
 
42
42
        self.assertIsInstance(optimiser, InterTree)
43
43
 
44
44
    def test_working_tree_revision_tree(self):
45
 
        # we should have an InterTree available for WorkingTree to
 
45
        # we should have an InterTree available for WorkingTree to 
46
46
        # RevisionTree.
47
47
        tree = self.make_branch_and_tree('.')
48
48
        rev_id = tree.commit('first post')
53
53
        self.assertIsInstance(optimiser, InterTree)
54
54
 
55
55
    def test_working_tree_working_tree(self):
56
 
        # we should have an InterTree available for WorkingTree to
 
56
        # we should have an InterTree available for WorkingTree to 
57
57
        # WorkingTree.
58
58
        tree = self.make_branch_and_tree('1')
59
59
        tree2 = self.make_branch_and_tree('2')
72
72
        want_unversioned=False):
73
73
        self.calls.append(
74
74
            ('compare', self.source, self.target, want_unchanged,
75
 
             specific_files, extra_trees, require_versioned,
 
75
             specific_files, extra_trees, require_versioned, 
76
76
             include_root, want_unversioned)
77
77
            )
78
 
 
 
78
    
79
79
    @classmethod
80
80
    def is_compatible(klass, source, target):
81
81
        return True
96
96
            # trivial usage
97
97
            tree.changes_from(tree2)
98
98
            # pass in all optional arguments by position
99
 
            tree.changes_from(tree2, 'unchanged', 'specific', 'extra',
 
99
            tree.changes_from(tree2, 'unchanged', 'specific', 'extra', 
100
100
                              'require', True)
101
101
            # pass in all optional arguments by keyword
102
102
            tree.changes_from(tree2,
123
123
        wt = self.make_branch_and_tree('.')
124
124
        delta = wt.changes_from(wt.basis_tree())
125
125
        self.assertEqual(len(delta.added), 0)
126
 
        delta = wt.changes_from(wt.basis_tree(), include_root=True)
 
126
        delta = wt.changes_from(wt.basis_tree(), wt, include_root=True)
127
127
        self.assertEqual(len(delta.added), 1)
128
128
        self.assertEqual(delta.added[0][0], '')
129
129
 
139
139
 
140
140
        # we need to pass a known file with an unknown file to get this to
141
141
        # fail when expected.
142
 
        delta = wt.changes_from(wt.basis_tree(),
 
142
        delta = wt.changes_from(wt.basis_tree(), wt, 
143
143
            specific_files=['known_file', 'unknown_file'] ,
144
144
            require_versioned=False)
145
145
        self.assertEqual(len(delta.added), 1)
210
210
                other_file_ids.append(None)
211
211
            else:
212
212
                other_file_ids.append(ie.file_id)
213
 
 
 
213
        
214
214
        exp_file_ids = []
215
215
        for path in exp_other_paths:
216
216
            if path is None: