~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-06-26 20:32:49 UTC
  • mto: (2581.1.1 cleanup-runbzr)
  • mto: This revision was merged to the branch mainline in revision 2588.
  • Revision ID: v.ladeuil+lp@free.fr-20070626203249-sqm4afiai5dxofum
Deprecate the varargs syntax and fix the tests.

* bzrlib/tests/__init__.py:
(TestCase.run_bzr): Activate the deprecation warning.
(TestCase.run_bzr_error): Add error_regexes to kwargs or run_bzr
get confused.

* bzrlib/tests/blackbox/test_selftest.py:
(TestRunBzr.test_args): Activate.

* bzrlib/tests/blackbox/test_inventory.py:
(TestInventory.assertInventoryEqual): Build the command from args
if not None.

* bzrlib/tests/blackbox/test_ls.py:
(TestLS.ls_equals): Build the command from args if not None.

* bzrlib/tests/blackbox/test_remove_tree.py:
(TestRemoveTree.test_remove_tree_lightweight_checkout_explicit):
Nice catch, we were calling run_bzr instead of run_bzr_error. This
went unnoticed for some time...

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
                ('','bzr: ERROR: No push location known or specified.\n'))
64
64
 
65
65
        # test not remembered if cannot actually push
66
 
        self.run_bzr('push', '../path/which/doesnt/exist', retcode=3)
 
66
        self.run_bzr('push ../path/which/doesnt/exist', retcode=3)
67
67
        out = self.run_bzr('push', retcode=3)
68
68
        self.assertEquals(
69
69
                ('', 'bzr: ERROR: No push location known or specified.\n'),
70
70
                out)
71
71
 
72
72
        # test implicit --remember when no push location set, push fails
73
 
        out = self.run_bzr('push', '../branch_b', retcode=3)
 
73
        out = self.run_bzr('push ../branch_b', retcode=3)
74
74
        self.assertEquals(out,
75
75
                ('','bzr: ERROR: These branches have diverged.  '
76
76
                    'Try using "merge" and then "push".\n'))
91
91
        self.assertEqual(path,
92
92
                         branch_b.bzrdir.root_transport.base)
93
93
        # test explicit --remember
94
 
        self.run_bzr('push', '../branch_c', '--remember')
 
94
        self.run_bzr('push ../branch_c --remember')
95
95
        self.assertEquals(branch_a.get_push_location(),
96
96
                          branch_c.bzrdir.root_transport.base)
97
97
    
98
98
    def test_push_without_tree(self):
99
99
        # bzr push from a branch that does not have a checkout should work.
100
100
        b = self.make_branch('.')
101
 
        out, err = self.run_bzr('push', 'pushed-location')
 
101
        out, err = self.run_bzr('push pushed-location')
102
102
        self.assertEqual('', out)
103
103
        self.assertEqual('Created new branch.\n', err)
104
104
        b2 = Branch.open('pushed-location')
113
113
        t.add('file')
114
114
        t.commit('commit 1')
115
115
        os.chdir('tree')
116
 
        out, err = self.run_bzr('push', 'pushed-to')
 
116
        out, err = self.run_bzr('push pushed-to')
117
117
        os.chdir('..')
118
118
        self.assertEqual('', out)
119
119
        self.assertEqual('Created new branch.\n', err)
150
150
        # Now that we have a repository with shared files, make sure
151
151
        # that things aren't copied out by a 'push'
152
152
        os.chdir('repo/b')
153
 
        self.run_bzr('push', '../../push-b')
 
153
        self.run_bzr('push ../../push-b')
154
154
        pushed_tree = WorkingTree.open('../../push-b')
155
155
        pushed_repo = pushed_tree.branch.repository
156
156
        self.assertFalse(pushed_repo.has_revision('a-1'))
163
163
        self.build_tree(['filename'])
164
164
        t.add('filename', 'funky-chars<>%&;"\'')
165
165
        t.commit('commit filename')
166
 
        self.run_bzr('push', '../new-tree')
 
166
        self.run_bzr('push ../new-tree')
167
167
 
168
168
    def test_push_dash_d(self):
169
169
        t = self.make_branch_and_tree('from')
187
187
        tree = self.create_simple_tree()
188
188
 
189
189
        self.run_bzr_error(['Parent directory of ../new/tree does not exist'],
190
 
                           'push', '../new/tree',
 
190
                           'push ../new/tree',
191
191
                           working_dir='tree')
192
 
        self.run_bzr('push', '../new/tree', '--create-prefix',
 
192
        self.run_bzr('push ../new/tree --create-prefix',
193
193
                     working_dir='tree')
194
194
        new_tree = WorkingTree.open('new/tree')
195
195
        self.assertEqual(tree.last_revision(), new_tree.last_revision())
205
205
 
206
206
        self.run_bzr_error(['Target directory ../target already exists',
207
207
                            'Supply --use-existing-dir',
208
 
                           ], 'push', '../target',
209
 
                           working_dir='tree')
 
208
                           ],
 
209
                           'push ../target', working_dir='tree')
210
210
 
211
 
        self.run_bzr('push', '--use-existing-dir', '../target',
 
211
        self.run_bzr('push --use-existing-dir ../target',
212
212
                     working_dir='tree')
213
213
 
214
214
        new_tree = WorkingTree.open('target')
221
221
        tree = self.create_simple_tree()
222
222
        repo = self.make_repository('repo', shared=True)
223
223
 
224
 
        self.run_bzr('push', '../repo',
 
224
        self.run_bzr('push ../repo',
225
225
                     working_dir='tree')
226
226
 
227
227
        # Pushing onto an existing bzrdir will create a repository and
242
242
        a_bzrdir = self.make_bzrdir('dir')
243
243
 
244
244
        self.run_bzr_error(['At ../dir you have a valid .bzr control'],
245
 
                'push', '../dir',
 
245
                'push ../dir',
246
246
                working_dir='tree')