~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_upgrade_stacked.py

  • Committer: Patch Queue Manager
  • Date: 2011-10-14 16:54:26 UTC
  • mfrom: (6216.1.1 remove-this-file)
  • Revision ID: pqm@pqm.ubuntu.com-20111014165426-tjix4e6idryf1r2z
(jelmer) Remove an accidentally committed .THIS file. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2011 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
19
19
 
20
20
from bzrlib import (
21
21
    bzrdir,
 
22
    check,
22
23
    errors,
23
24
    tests,
24
25
    )
25
26
from bzrlib.upgrade import upgrade
 
27
from bzrlib.tests.scenarios import load_tests_apply_scenarios
 
28
 
 
29
 
 
30
def upgrade_scenarios():
 
31
    scenario_pairs = [ # old format, new format, model_change
 
32
#        ('knit', 'rich-root', True),
 
33
        ('knit', '1.6', False),
 
34
#        ('pack-0.92', '1.6', False),
 
35
        ('1.6', '1.6.1-rich-root', True),
 
36
        ]
 
37
    scenarios = []
 
38
    for (old_name, new_name, model_change) in scenario_pairs:
 
39
        name = old_name + ', ' + new_name
 
40
        scenarios.append((name,
 
41
            dict(scenario_old_format=old_name,
 
42
                scenario_new_format=new_name,
 
43
                scenario_model_change=model_change)))
 
44
    return scenarios
 
45
 
 
46
 
 
47
load_tests = load_tests_apply_scenarios
26
48
 
27
49
 
28
50
class TestStackUpgrade(tests.TestCaseWithTransport):
29
51
    # TODO: This should possibly be repeated for all stacking repositories,
30
52
    # pairwise by rich/non-rich format; should possibly also try other kinds
31
53
    # of upgrades like knit->pack. -- mbp 20080804
 
54
    
 
55
    scenarios = upgrade_scenarios()
32
56
 
33
57
    def test_stack_upgrade(self):
34
58
        """Correct checks when stacked-on repository is upgraded.
56
80
            self.assertRaises(errors.IncompatibleRepositories,
57
81
                stacked.open_branch)
58
82
        else:
59
 
            stacked.open_branch().check()
 
83
            check.check_dwim('stacked', False, True, True)
60
84
        stacked = bzrdir.BzrDir.open('stacked')
61
85
        # but we can upgrade the stacked repository
62
86
        upgrade('stacked', new_format)
63
 
        # and now it's ok
 
87
        # and now it opens ok
64
88
        stacked = bzrdir.BzrDir.open('stacked')
65
 
        stacked.open_branch().check()
66
 
 
67
 
 
68
 
def load_tests(basic_tests, module, loader):
69
 
    """Generate dynamic scenario tests.
70
 
 
71
 
    Called by the bzrlib test framework.
72
 
    """
73
 
    scenario_pairs = [ # old format, new format, model_change
74
 
#        ('knit', 'rich-root', True),
75
 
        ('knit', '1.6', False),
76
 
#        ('pack-0.92', '1.6', False),
77
 
        ('1.6', '1.6.1-rich-root', True),
78
 
        ]
79
 
    scenarios = []
80
 
    for (old_name, new_name, model_change) in scenario_pairs:
81
 
        name = old_name + ', ' + new_name
82
 
        scenarios.append((name,
83
 
            dict(scenario_old_format=old_name,
84
 
                scenario_new_format=new_name,
85
 
                scenario_model_change=model_change)))
86
 
    suite = loader.suiteClass()
87
 
    return tests.multiply_tests(basic_tests, scenarios, suite)
 
89
        # And passes check.
 
90
        check.check_dwim('stacked', False, True, True)