~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2015-04-21 05:32:33 UTC
  • mfrom: (6602.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20150421053233-x63rhby1q3612v2h
(richard-wilbur) (jelmer)Make bzr build reproducible for Debian. (Jelmer
 Vernooij)

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 (
46
47
            tests.selftest = original_selftest
47
48
 
48
49
 
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
 
 
67
50
class TestOptions(tests.TestCase, SelfTestPatch):
68
51
 
69
52
    def test_load_list(self):
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)