~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-05-28 00:25:32 UTC
  • mfrom: (5264.1.2 command-help-bug-177500)
  • Revision ID: pqm@pqm.ubuntu.com-20100528002532-9bzj1fajyxckd1rg
(lifeless) Stop raising at runtime when a command has no help,
 instead have a test in the test suite that checks all known command objects.
 (Robert Collins)

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
 
 
21
19
from bzrlib import (
 
20
    benchmarks,
22
21
    tests,
23
22
    )
24
23
from bzrlib.tests import (
47
46
            tests.selftest = original_selftest
48
47
 
49
48
 
 
49
class TestOptionsWritingToDisk(tests.TestCaseInTempDir, SelfTestPatch):
 
50
 
 
51
    def test_benchmark_runs_benchmark_tests(self):
 
52
        """selftest --benchmark should change the suite factory."""
 
53
        params = self.get_params_passed_to_core('selftest --benchmark')
 
54
        self.assertEqual(benchmarks.test_suite,
 
55
            params[1]['test_suite_factory'])
 
56
        self.assertNotEqual(None, params[1]['bench_history'])
 
57
        benchfile = open(".perf_history", "rt")
 
58
        try:
 
59
            lines = benchfile.readlines()
 
60
        finally:
 
61
            benchfile.close()
 
62
        # Because we don't run the actual test code no output is made to the
 
63
        # file.
 
64
        self.assertEqual(0, len(lines))
 
65
 
 
66
 
50
67
class TestOptions(tests.TestCase, SelfTestPatch):
51
68
 
52
69
    def test_load_list(self):
150
167
    def test_lsprof_tests(self):
151
168
        params = self.get_params_passed_to_core('selftest --lsprof-tests')
152
169
        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)