~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: 2010-10-08 10:50:51 UTC
  • mfrom: (5050.17.31 2.2.2-dev)
  • mto: This revision was merged to the branch mainline in revision 5474.
  • Revision ID: v.ladeuil+lp@free.fr-20101008105051-xd4knkrohzclffic
Merge 2.2 into trunk including fixes for bug #651706 and bug #646133

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2011 Canonical Ltd
 
1
# Copyright (C) 2006-2010 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
34
34
from bzrlib.tests import (
35
35
    blackbox,
36
36
    http_server,
37
 
    scenarios,
38
37
    test_foreign,
39
38
    test_server,
40
39
    )
41
40
from bzrlib.transport import memory
42
41
 
43
42
 
44
 
load_tests = scenarios.load_tests_apply_scenarios
 
43
def load_tests(standard_tests, module, loader):
 
44
    """Multiply tests for the push command."""
 
45
    result = loader.suiteClass()
 
46
 
 
47
    # one for each king of change
 
48
    changes_tests, remaining_tests = tests.split_suite_by_condition(
 
49
        standard_tests, tests.condition_isinstance((
 
50
                TestPushStrictWithChanges,
 
51
                )))
 
52
    changes_scenarios = [
 
53
        ('uncommitted',
 
54
         dict(_changes_type= '_uncommitted_changes')),
 
55
        ('pending-merges',
 
56
         dict(_changes_type= '_pending_merges')),
 
57
        ('out-of-sync-trees',
 
58
         dict(_changes_type= '_out_of_sync_trees')),
 
59
        ]
 
60
    tests.multiply_tests(changes_tests, changes_scenarios, result)
 
61
    # No parametrization for the remaining tests
 
62
    result.addTests(remaining_tests)
 
63
 
 
64
    return result
45
65
 
46
66
 
47
67
class TestPush(tests.TestCaseWithTransport):
126
146
        b2 = branch.Branch.open('pushed-location')
127
147
        self.assertEndsWith(b2.base, 'pushed-location/')
128
148
 
129
 
    def test_push_no_tree(self):
130
 
        # bzr push --no-tree of a branch with working trees
131
 
        b = self.make_branch_and_tree('push-from')
132
 
        self.build_tree(['push-from/file'])
133
 
        b.add('file')
134
 
        b.commit('commit 1')
135
 
        out, err = self.run_bzr('push --no-tree -d push-from push-to')
136
 
        self.assertEqual('', out)
137
 
        self.assertEqual('Created new branch.\n', err)
138
 
        self.failIfExists('push-to/file')
139
 
 
140
149
    def test_push_new_branch_revision_count(self):
141
150
        # bzr push of a branch with revisions to a new location
142
151
        # should print the number of revisions equal to the length of the
231
240
        # being too low. If rpc_count increases, more network roundtrips have
232
241
        # become necessary for this use case. Please do not adjust this number
233
242
        # upwards without agreement from bzr's network support maintainers.
234
 
        self.assertLength(13, self.hpss_calls)
 
243
        self.assertLength(14, self.hpss_calls)
235
244
        remote = branch.Branch.open('public')
236
245
        self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
237
246
 
709
718
        self.assertPushSucceeds([])
710
719
 
711
720
 
712
 
strict_push_change_scenarios = [
713
 
    ('uncommitted',
714
 
        dict(_changes_type= '_uncommitted_changes')),
715
 
    ('pending-merges',
716
 
        dict(_changes_type= '_pending_merges')),
717
 
    ('out-of-sync-trees',
718
 
        dict(_changes_type= '_out_of_sync_trees')),
719
 
    ]
720
 
 
721
 
 
722
721
class TestPushStrictWithChanges(tests.TestCaseWithTransport,
723
722
                                TestPushStrictMixin):
724
723
 
725
 
    scenarios = strict_push_change_scenarios 
726
724
    _changes_type = None # Set by load_tests
727
725
 
728
726
    def setUp(self):