~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testchangeset.py

  • Committer: John Arbash Meinel
  • Date: 2005-07-11 06:57:50 UTC
  • mto: (0.5.85) (1185.82.1 bzr-w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: john@arbash-meinel.com-20050711065750-6da62e4042bd87e6
Working on test cases, starting with the empty project issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import unittest
4
4
from StringIO import StringIO
5
5
 
 
6
from bzrlib.selftest import InTempDir
 
7
 
6
8
from bzrlib.diff import internal_diff
7
9
from read_changeset import ChangesetTree
8
10
 
206
208
        ctree.note_id("e", "grandparent/alt_parent/fool")
207
209
        self.assertEqual(self.sorted_ids(ctree), ['a', 'b', 'd', 'e'])
208
210
 
209
 
def test():
210
 
    patchesTestSuite = unittest.makeSuite(CTreeTester,'test_')
211
 
    runner = unittest.TextTestRunner()
212
 
    runner.run(patchesTestSuite)
213
 
 
 
211
class CSetTester(InTempDir):
 
212
    def test_add(self):
 
213
        from bzrlib.branch import find_branch
 
214
        from gen_changeset import show_changeset
 
215
        from read_changeset import read_changeset
 
216
        import common
 
217
 
 
218
        import os
 
219
        from cStringIO import StringIO
 
220
        pjoin = os.path.join
 
221
 
 
222
        os.mkdir('b1')
 
223
        os.mkdir('b2')
 
224
        self.b1 = find_branch('b1', init=True)
 
225
        self.b2 = find_branch('b2', init=True)
 
226
 
 
227
        open(pjoin('b1/one'), 'wb').write('one\n')
 
228
        self.b1.add('one')
 
229
        self.b1.commit('add one', rev_id='a@cset-0-1')
 
230
 
 
231
        cset_txt = StringIO()
 
232
        show_changeset(self.b1, None, self.b1, 'a@cset-0-1', to_file=cset_txt)
 
233
        cset_txt.seek(0)
 
234
        self.assertEqual(cset_txt.readline(), '# Bazaar-NG changeset v0.0.5\n')
 
235
        self.assertEqual(cset_txt.readline(), '# \n')
 
236
 
 
237
        cset_txt.seek(0)
 
238
        # This should also validate the generate changeset
 
239
        info, tree, inv = read_changeset(cset_txt, self.b1)
 
240
 
 
241
TEST_CLASSES = [
 
242
    CTreeTester,
 
243
    CSetTester
 
244
]
214
245