~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2010-08-04 04:33:24 UTC
  • mto: This revision was merged to the branch mainline in revision 5390.
  • Revision ID: john@arbash-meinel.com-20100804043324-1ldc2v2w1kza7ox4
get into the nitty gritty for the _key_to_sha1 function.

It doesn't seem to help to op-out of the actual unhexlify call, so at least
that doesn't seem to be the performance overhead.
We get down to around 19.9us for _key_to_sha1 across 120 keys, which is
0.166us per key.

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