~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
"""
21
21
 
22
22
import os
23
 
import sys
24
 
 
25
 
from bzrlib.tests.blackbox import TestCaseWithTransport
26
 
 
27
 
class TestCat(TestCaseWithTransport):
 
23
 
 
24
from bzrlib import tests
 
25
 
 
26
 
 
27
class TestCat(tests.TestCaseWithTransport):
28
28
 
29
29
    def test_cat(self):
30
30
        tree = self.make_branch_and_tree('branch')
68
68
 
69
69
    def test_cat_different_id(self):
70
70
        """'cat' works with old and new files"""
 
71
        self.disable_missing_extensions_warning()
71
72
        tree = self.make_branch_and_tree('.')
72
73
        # the files are named after their path in the revision and
73
74
        # current trees later in the test case
126
127
        out, err = self.run_bzr_subprocess(['cat', url])
127
128
        self.assertEqual('contents of README\n', out)
128
129
 
 
130
    def test_cat_branch_revspec(self):
 
131
        wt = self.make_branch_and_tree('a')
 
132
        self.build_tree(['a/README'])
 
133
        wt.add('README')
 
134
        wt.commit('Making sure there is a basis_tree available')
 
135
        wt = self.make_branch_and_tree('b')
 
136
        os.chdir('b')
 
137
 
 
138
        out, err = self.run_bzr_subprocess(
 
139
            ['cat', '-r', 'branch:../a', 'README'])
 
140
        self.assertEqual('contents of a/README\n', out)
 
141
 
129
142
    def test_cat_filters(self):
130
143
        wt = self.make_branch_and_tree('.')
131
144
        self.build_tree(['README'])
182
195
        self.assertEqual('contents of README\n', out)
183
196
 
184
197
    def test_cat_nonexistent_branch(self):
185
 
        if sys.platform == "win32":
186
 
            location = "C:/i/do/not/exist"
187
 
        else:
188
 
            location = "/i/do/not/exist"
189
 
        self.run_bzr_error(['^bzr: ERROR: Not a branch'], ['cat', location])
 
198
        self.vfs_transport_factory = tests.MemoryServer
 
199
        self.run_bzr_error(['^bzr: ERROR: Not a branch'],
 
200
                           ['cat', self.get_url()])