~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lsprof.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2009, 2010, 2011 Canonical Ltd
 
1
# Copyright (C) 2007, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
 
19
19
 
20
20
import cPickle
 
21
import os
21
22
import threading
22
23
 
23
24
import bzrlib
24
25
from bzrlib import errors, tests
25
 
from bzrlib.tests import (
26
 
    features,
27
 
    )
 
26
 
 
27
 
 
28
class _LSProfFeature(tests.Feature):
 
29
 
 
30
    def available(self):
 
31
        try:
 
32
            from bzrlib import lsprof
 
33
        except ImportError:
 
34
            return False
 
35
        else:
 
36
            return True
 
37
 
 
38
 
 
39
LSProfFeature = _LSProfFeature()
28
40
 
29
41
 
30
42
_TXT_HEADER = "   CallCount    Recursive    Total(ms)   " + \
45
57
 
46
58
class TestStatsSave(tests.TestCaseInTempDir):
47
59
 
48
 
    _test_needs_features = [features.lsprof_feature]
 
60
    _test_needs_features = [LSProfFeature]
49
61
 
50
62
    def setUp(self):
51
63
        super(tests.TestCaseInTempDir, self).setUp()
85
97
 
86
98
class TestBzrProfiler(tests.TestCase):
87
99
 
88
 
    _test_needs_features = [features.lsprof_feature]
 
100
    _test_needs_features = [LSProfFeature]
89
101
 
90
102
    def test_start_call_stuff_stop(self):
91
103
        profiler = bzrlib.lsprof.BzrProfiler()