~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge bzr.dev.

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
 
    stub_sftp,
26
 
    )
27
 
from bzrlib.transport import memory
 
26
                          features,
 
27
                          TestCase,
 
28
                          TestCaseInTempDir,
 
29
                          TestSkipped,
 
30
                          )
 
31
 
28
32
 
29
33
class SelfTestPatch:
30
34
 
47
51
            tests.selftest = original_selftest
48
52
 
49
53
 
50
 
class TestOptionsWritingToDisk(tests.TestCaseInTempDir, SelfTestPatch):
 
54
class TestOptionsWritingToDisk(TestCaseInTempDir, SelfTestPatch):
51
55
 
52
56
    def test_benchmark_runs_benchmark_tests(self):
53
57
        """selftest --benchmark should change the suite factory."""
65
69
        self.assertEqual(0, len(lines))
66
70
 
67
71
 
68
 
class TestOptions(tests.TestCase, SelfTestPatch):
 
72
class TestOptions(TestCase, SelfTestPatch):
69
73
 
70
74
    def test_load_list(self):
71
75
        params = self.get_params_passed_to_core('selftest --load-list foo')
76
80
        # version.
77
81
        self.requireFeature(features.paramiko)
78
82
        params = self.get_params_passed_to_core('selftest --transport=sftp')
79
 
        self.assertEqual(stub_sftp.SFTPAbsoluteServer,
 
83
        self.assertEqual(bzrlib.transport.sftp.SFTPAbsoluteServer,
80
84
            params[1]["transport"])
81
85
 
82
86
    def test_transport_set_to_memory(self):
83
87
        # Test that we can pass a transport to the selftest core - memory
84
88
        # version.
 
89
        import bzrlib.transport.memory
85
90
        params = self.get_params_passed_to_core('selftest --transport=memory')
86
 
        self.assertEqual(memory.MemoryServer, params[1]["transport"])
 
91
        self.assertEqual(bzrlib.transport.memory.MemoryServer,
 
92
            params[1]["transport"])
87
93
 
88
94
    def test_parameters_passed_to_core(self):
89
95
        params = self.get_params_passed_to_core('selftest --list-only')