~jelmer/ubuntu/maverick/bzr/proposed-2.2.3

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_revision_info.py

  • Committer: Bazaar Package Importer
  • Author(s): Steinar H. Gunderson
  • Date: 2006-11-08 01:28:55 UTC
  • mfrom: (1.1.15 upstream) (3.1.14 edgy)
  • Revision ID: james.westby@ubuntu.com-20061108012855-faugrhqdxr3cuu9o
Tags: 0.11-1.1
* Non-maintainer upload.
* In test_osutils.py, sort what we get from os.listdir() before checking it;
  the OS can give back directory entries in whatever order it likes, and
  this shouldn't break the tests. Fixes intermittent test failures and
  FTBFS. (Closes: #395203)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2004, 2005 by 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
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
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
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
18
 
from bzrlib.tests import TestCaseInTempDir
 
18
 
19
19
from bzrlib.errors import BzrCommandError, NoSuchRevision
20
 
from bzrlib.branch import Branch
21
 
from bzrlib.revisionspec import RevisionSpec
22
 
 
23
 
class TestRevisionInfo(TestCaseInTempDir):
 
20
from bzrlib.tests import TestCaseWithTransport
 
21
from bzrlib.workingtree import WorkingTree
 
22
 
 
23
 
 
24
class TestRevisionInfo(TestCaseWithTransport):
24
25
    
25
26
    def check_error(self, output, *args):
26
27
        """Verify that the expected error matches what bzr says.
39
40
        self.assertEquals(self.run_bzr_captured(args)[0], output)
40
41
 
41
42
    def test_revision_info(self):
42
 
        """Test that 'bzr revision-info' reports the correct thing.
43
 
        """
44
 
 
45
 
        b = Branch.initialize(u'.')
46
 
 
47
 
        b.working_tree().commit('Commit one', rev_id='a@r-0-1')
48
 
        b.working_tree().commit('Commit two', rev_id='a@r-0-2')
49
 
        b.working_tree().commit('Commit three', rev_id='a@r-0-3')
 
43
        """Test that 'bzr revision-info' reports the correct thing."""
 
44
        wt = self.make_branch_and_tree('.')
 
45
 
 
46
        wt.commit('Commit one', rev_id='a@r-0-1')
 
47
        wt.commit('Commit two', rev_id='a@r-0-2')
 
48
        wt.commit('Commit three', rev_id='a@r-0-3')
50
49
 
51
50
        # Make sure revision-info without any arguments throws an exception
52
51
        self.check_error('bzr: ERROR: '
85
84
    def test_cat_revision(self):
86
85
        """Test bzr cat-revision.
87
86
        """
88
 
        b = Branch.initialize(u'.')
 
87
        wt = self.make_branch_and_tree('.')
 
88
        r = wt.branch.repository
89
89
 
90
 
        b.working_tree().commit('Commit one', rev_id='a@r-0-1')
91
 
        b.working_tree().commit('Commit two', rev_id='a@r-0-2')
92
 
        b.working_tree().commit('Commit three', rev_id='a@r-0-3')
 
90
        wt.commit('Commit one', rev_id='a@r-0-1')
 
91
        wt.commit('Commit two', rev_id='a@r-0-2')
 
92
        wt.commit('Commit three', rev_id='a@r-0-3')
93
93
 
94
94
        revs = {
95
 
            1:b.get_revision_xml('a@r-0-1'),
96
 
            2:b.get_revision_xml('a@r-0-2'),
97
 
            3:b.get_revision_xml('a@r-0-3')
 
95
            1:r.get_revision_xml('a@r-0-1'),
 
96
            2:r.get_revision_xml('a@r-0-2'),
 
97
            3:r.get_revision_xml('a@r-0-3'),
98
98
        }
99
99
 
100
100
        self.check_output(revs[1], 'cat-revision', 'a@r-0-1')