~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-10-07 12:45:51 UTC
  • mfrom: (5459.4.1 561061-ssh-protocol)
  • Revision ID: pqm@pqm.ubuntu.com-20101007124551-zfqhlkqdegiy7otp
(vila) Don't force openssh to use protocol=2 (Neil Martinsen-Burrell)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""UI tests for the test framework."""
18
18
 
 
19
import os
 
20
 
19
21
from bzrlib import (
20
 
    benchmarks,
21
22
    tests,
22
23
    )
23
24
from bzrlib.tests import (
24
25
    features,
25
 
    stub_sftp,
26
26
    )
27
27
from bzrlib.transport import memory
28
28
 
47
47
            tests.selftest = original_selftest
48
48
 
49
49
 
50
 
class TestOptionsWritingToDisk(tests.TestCaseInTempDir, SelfTestPatch):
51
 
 
52
 
    def test_benchmark_runs_benchmark_tests(self):
53
 
        """selftest --benchmark should change the suite factory."""
54
 
        params = self.get_params_passed_to_core('selftest --benchmark')
55
 
        self.assertEqual(benchmarks.test_suite,
56
 
            params[1]['test_suite_factory'])
57
 
        self.assertNotEqual(None, params[1]['bench_history'])
58
 
        benchfile = open(".perf_history", "rt")
59
 
        try:
60
 
            lines = benchfile.readlines()
61
 
        finally:
62
 
            benchfile.close()
63
 
        # Because we don't run the actual test code no output is made to the
64
 
        # file.
65
 
        self.assertEqual(0, len(lines))
66
 
 
67
 
 
68
50
class TestOptions(tests.TestCase, SelfTestPatch):
69
51
 
70
52
    def test_load_list(self):
75
57
        # Test that we can pass a transport to the selftest core - sftp
76
58
        # version.
77
59
        self.requireFeature(features.paramiko)
 
60
        from bzrlib.tests import stub_sftp
78
61
        params = self.get_params_passed_to_core('selftest --transport=sftp')
79
62
        self.assertEqual(stub_sftp.SFTPAbsoluteServer,
80
63
            params[1]["transport"])
167
150
    def test_lsprof_tests(self):
168
151
        params = self.get_params_passed_to_core('selftest --lsprof-tests')
169
152
        self.assertEqual(True, params[1]["lsprof_tests"])
 
153
 
 
154
    def test_parallel_fork_unsupported(self):
 
155
        if getattr(os, "fork", None) is not None:
 
156
            self.addCleanup(setattr, os, "fork", os.fork)
 
157
            del os.fork
 
158
        out, err = self.run_bzr(["selftest", "--parallel=fork", "-s", "bt.x"],
 
159
            retcode=3)
 
160
        self.assertIn("platform does not support fork", err)
 
161
        self.assertFalse(out)