/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 21:59:15 UTC
  • mto: This revision was merged to the branch mainline in revision 6690.
  • Revision ID: jelmer@jelmer.uk-20170610215915-zcpu0in3r1irx3ml
Move serializer to bzr.

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
 
from bzrlib import (
20
 
    benchmarks,
 
19
import os
 
20
 
 
21
from breezy import (
21
22
    tests,
22
23
    )
23
 
from bzrlib.tests import (
 
24
from breezy.tests import (
24
25
    features,
25
26
    )
26
 
from bzrlib.transport import memory
 
27
from breezy.transport import memory
27
28
 
28
29
class SelfTestPatch:
29
30
 
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):
74
57
        # Test that we can pass a transport to the selftest core - sftp
75
58
        # version.
76
59
        self.requireFeature(features.paramiko)
77
 
        from bzrlib.tests import stub_sftp
 
60
        from breezy.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"])
140
123
        return (header,body,footer)
141
124
 
142
125
    def test_list_only(self):
143
 
        # check that bzr selftest --list-only outputs no ui noise
 
126
        # check that brz selftest --list-only outputs no ui noise
144
127
        def selftest(*args, **kwargs):
145
128
            """Capture the arguments selftest was run with."""
146
129
            return True
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)