~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-11-22 03:35:24 UTC
  • mto: This revision was merged to the branch mainline in revision 5547.
  • Revision ID: andrew.bennetts@canonical.com-20101122033524-ouxj0onm3gtkimx3
Remove RepositoryFormatCHK1 and RepositoryFormatCHK2.

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
# Authors: Aaron Bentley
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
27
27
    )
28
28
from bzrlib.bundle import serializer
29
29
from bzrlib.transport import memory
30
 
from bzrlib.tests import (
31
 
    scenarios,
32
 
    script,
33
 
    )
34
 
 
35
 
 
36
 
load_tests = scenarios.load_tests_apply_scenarios
 
30
 
 
31
 
 
32
def load_tests(standard_tests, module, loader):
 
33
    """Multiply tests for the send command."""
 
34
    result = loader.suiteClass()
 
35
 
 
36
    # one for each king of change
 
37
    changes_tests, remaining_tests = tests.split_suite_by_condition(
 
38
        standard_tests, tests.condition_isinstance((
 
39
                TestSendStrictWithChanges,
 
40
                )))
 
41
    changes_scenarios = [
 
42
        ('uncommitted',
 
43
         dict(_changes_type='_uncommitted_changes')),
 
44
        ('pending_merges',
 
45
         dict(_changes_type='_pending_merges')),
 
46
        ('out-of-sync-trees',
 
47
         dict(_changes_type='_out_of_sync_trees')),
 
48
        ]
 
49
    tests.multiply_tests(changes_tests, changes_scenarios, result)
 
50
    # No parametrization for the remaining tests
 
51
    result.addTests(remaining_tests)
 
52
 
 
53
    return result
37
54
 
38
55
 
39
56
class TestSendMixin(object):
189
206
 
190
207
    def test_note_revisions(self):
191
208
        stderr = self.run_send([])[1]
192
 
        self.assertEndsWith(stderr, '\nBundling 1 revision.\n')
 
209
        self.assertEndsWith(stderr, '\nBundling 1 revision(s).\n')
193
210
 
194
211
    def test_mailto_option(self):
195
212
        b = branch.Branch.open('branch')
296
313
    def set_config_send_strict(self, value):
297
314
        # set config var (any of bazaar.conf, locations.conf, branch.conf
298
315
        # should do)
299
 
        conf = self.local_tree.branch.get_config_stack()
300
 
        conf.set('send_strict', value)
 
316
        conf = self.local_tree.branch.get_config()
 
317
        conf.set_user_option('send_strict', value)
301
318
 
302
319
    def assertSendFails(self, args):
303
320
        out, err = self.run_send(args, rc=3, err_re=self._default_errors)
311
328
        if revs is None:
312
329
            revs = self._default_sent_revs
313
330
        out, err = self.run_send(args, err_re=err_re)
314
 
        if len(revs) == 1:
315
 
            bundling_revs = 'Bundling %d revision.\n'% len(revs)
316
 
        else:
317
 
            bundling_revs = 'Bundling %d revisions.\n' % len(revs)
 
331
        bundling_revs = 'Bundling %d revision(s).\n' % len(revs)
318
332
        if with_warning:
319
333
            self.assertContainsRe(err, self._default_additional_warning)
320
334
            self.assertEndsWith(err, bundling_revs)
352
366
 
353
367
 
354
368
class TestSendStrictWithChanges(tests.TestCaseWithTransport,
355
 
                                TestSendStrictMixin):
356
 
 
357
 
    # These are textually the same as test_push.strict_push_change_scenarios,
358
 
    # but since the functions are reimplemented here, the definitions are left
359
 
    # here too.
360
 
    scenarios = [
361
 
        ('uncommitted',
362
 
         dict(_changes_type='_uncommitted_changes')),
363
 
        ('pending_merges',
364
 
         dict(_changes_type='_pending_merges')),
365
 
        ('out-of-sync-trees',
366
 
         dict(_changes_type='_out_of_sync_trees')),
367
 
        ]
 
369
                                   TestSendStrictMixin):
368
370
 
369
371
    _changes_type = None # Set by load_tests
370
372