/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2009-12-10 00:13:16 UTC
  • mto: This revision was merged to the branch mainline in revision 4884.
  • Revision ID: mbp@sourcefrog.net-20091210001316-w1l2jtek6v8iyg49
Mention GNU project in --version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2007 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
16
16
 
17
17
"""UI tests for the test framework."""
18
18
 
 
19
import bzrlib.transport
19
20
from bzrlib import (
20
21
    benchmarks,
21
22
    tests,
22
23
    )
 
24
from bzrlib.errors import ParamikoNotPresent
23
25
from bzrlib.tests import (
24
 
    features,
25
 
    )
26
 
from bzrlib.transport import memory
 
26
                          SubUnitFeature,
 
27
                          TestCase,
 
28
                          TestCaseInTempDir,
 
29
                          TestSkipped,
 
30
                          )
 
31
 
27
32
 
28
33
class SelfTestPatch:
29
34
 
46
51
            tests.selftest = original_selftest
47
52
 
48
53
 
49
 
class TestOptionsWritingToDisk(tests.TestCaseInTempDir, SelfTestPatch):
 
54
class TestOptionsWritingToDisk(TestCaseInTempDir, SelfTestPatch):
50
55
 
51
56
    def test_benchmark_runs_benchmark_tests(self):
52
57
        """selftest --benchmark should change the suite factory."""
64
69
        self.assertEqual(0, len(lines))
65
70
 
66
71
 
67
 
class TestOptions(tests.TestCase, SelfTestPatch):
 
72
class TestOptions(TestCase, SelfTestPatch):
68
73
 
69
74
    def test_load_list(self):
70
75
        params = self.get_params_passed_to_core('selftest --load-list foo')
73
78
    def test_transport_set_to_sftp(self):
74
79
        # Test that we can pass a transport to the selftest core - sftp
75
80
        # version.
76
 
        self.requireFeature(features.paramiko)
77
 
        from bzrlib.tests import stub_sftp
 
81
        try:
 
82
            import bzrlib.transport.sftp
 
83
        except ParamikoNotPresent:
 
84
            raise TestSkipped("Paramiko not present")
78
85
        params = self.get_params_passed_to_core('selftest --transport=sftp')
79
 
        self.assertEqual(stub_sftp.SFTPAbsoluteServer,
 
86
        self.assertEqual(bzrlib.transport.sftp.SFTPAbsoluteServer,
80
87
            params[1]["transport"])
81
88
 
82
89
    def test_transport_set_to_memory(self):
83
90
        # Test that we can pass a transport to the selftest core - memory
84
91
        # version.
 
92
        import bzrlib.transport.memory
85
93
        params = self.get_params_passed_to_core('selftest --transport=memory')
86
 
        self.assertEqual(memory.MemoryServer, params[1]["transport"])
 
94
        self.assertEqual(bzrlib.transport.memory.MemoryServer,
 
95
            params[1]["transport"])
87
96
 
88
97
    def test_parameters_passed_to_core(self):
89
98
        params = self.get_params_passed_to_core('selftest --list-only')
107
116
        self.assertEqual(['foo', 'bar'], params[1]['starting_with'])
108
117
 
109
118
    def test_subunit(self):
110
 
        self.requireFeature(features.subunit)
 
119
        self.requireFeature(SubUnitFeature)
111
120
        params = self.get_params_passed_to_core('selftest --subunit')
112
121
        self.assertEqual(tests.SubUnitBzrRunner, params[1]['runner_class'])
113
122