~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lsprof.py

  • Committer: Jonathan Riddell
  • Date: 2011-05-16 11:27:37 UTC
  • mto: This revision was merged to the branch mainline in revision 5869.
  • Revision ID: jriddell@canonical.com-20110516112737-gep642p24rtzp3jt
userĀ guideĀ licence

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import bzrlib
24
24
from bzrlib import errors, tests
25
 
from bzrlib.tests import (
26
 
    features,
27
 
    )
 
25
 
 
26
 
 
27
class _LSProfFeature(tests.Feature):
 
28
 
 
29
    def available(self):
 
30
        try:
 
31
            from bzrlib import lsprof
 
32
        except ImportError:
 
33
            return False
 
34
        else:
 
35
            return True
 
36
 
 
37
 
 
38
LSProfFeature = _LSProfFeature()
28
39
 
29
40
 
30
41
_TXT_HEADER = "   CallCount    Recursive    Total(ms)   " + \
45
56
 
46
57
class TestStatsSave(tests.TestCaseInTempDir):
47
58
 
48
 
    _test_needs_features = [features.lsprof_feature]
 
59
    _test_needs_features = [LSProfFeature]
49
60
 
50
61
    def setUp(self):
51
62
        super(tests.TestCaseInTempDir, self).setUp()
85
96
 
86
97
class TestBzrProfiler(tests.TestCase):
87
98
 
88
 
    _test_needs_features = [features.lsprof_feature]
 
99
    _test_needs_features = [LSProfFeature]
89
100
 
90
101
    def test_start_call_stuff_stop(self):
91
102
        profiler = bzrlib.lsprof.BzrProfiler()