~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2010-04-01 04:41:18 UTC
  • mto: This revision was merged to the branch mainline in revision 5128.
  • Revision ID: mbp@sourcefrog.net-20100401044118-shyctqc02ob08ngz
ignore .testrepository

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""UI tests for the test framework."""
18
18
 
19
19
from bzrlib import (
 
20
    benchmarks,
20
21
    tests,
21
22
    )
22
23
from bzrlib.tests import (
23
24
    features,
 
25
    stub_sftp,
24
26
    )
25
27
from bzrlib.transport import memory
26
28
 
45
47
            tests.selftest = original_selftest
46
48
 
47
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
 
48
68
class TestOptions(tests.TestCase, SelfTestPatch):
49
69
 
50
70
    def test_load_list(self):
55
75
        # Test that we can pass a transport to the selftest core - sftp
56
76
        # version.
57
77
        self.requireFeature(features.paramiko)
58
 
        from bzrlib.tests import stub_sftp
59
78
        params = self.get_params_passed_to_core('selftest --transport=sftp')
60
79
        self.assertEqual(stub_sftp.SFTPAbsoluteServer,
61
80
            params[1]["transport"])