~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_controldir.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-10 16:00:38 UTC
  • mto: (5712.4.8 bzrdir-weave)
  • mto: This revision was merged to the branch mainline in revision 5716.
  • Revision ID: jelmer@samba.org-20110310160038-qrff0b1ezht4pcj0
Add Prober.known_formats().

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from bzrlib import (
23
23
    controldir,
 
24
    errors,
24
25
    tests,
25
26
    )
 
27
from bzrlib.tests.scenarios import load_tests_apply_scenarios
 
28
 
 
29
 
 
30
load_tests = load_tests_apply_scenarios
26
31
 
27
32
 
28
33
class SampleComponentFormat(controldir.ControlComponentFormat):
107
112
            controldir.ControlDirFormat.known_formats())
108
113
        self.assertRaises(KeyError,
109
114
            controldir.ControlDirFormat.unregister_format, "myformat")
 
115
 
 
116
 
 
117
class TestProber(tests.TestCaseWithTransport):
 
118
 
 
119
    scenarios = [
 
120
        (prober_cls.__name__, {'prober_cls': prober_cls})
 
121
        for prober_cls in controldir.ControlDirFormat._probers]
 
122
 
 
123
    def setUp(self):
 
124
        super(TestProber, self).setUp()
 
125
        self.prober = self.prober_cls()
 
126
 
 
127
    def test_probe_transport_empty(self):
 
128
        transport = self.get_transport(".")
 
129
        self.assertRaises(errors.NotBranchError,
 
130
            self.prober.probe_transport, transport)
 
131
 
 
132
    def test_known_formats(self):
 
133
        known_formats = self.prober.known_formats()
 
134
        self.assertIsInstance(known_formats, set)
 
135
        for format in known_formats:
 
136
            self.assertIsInstance(format, controldir.ControlDirFormat,
 
137
                repr(format))