~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2011-12-05 14:12:23 UTC
  • mto: This revision was merged to the branch mainline in revision 6348.
  • Revision ID: jelmer@samba.org-20111205141223-8qxae4h37satlzgq
Move more functionality to vf_search.

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)