~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__static_tuple.py

  • Committer: Martin Pool
  • Date: 2011-06-14 01:26:41 UTC
  • mto: (6034.2.1 integration)
  • mto: This revision was merged to the branch mainline in revision 6043.
  • Revision ID: mbp@canonical.com-20110614012641-dnb69zb57ae5je4w
Move all test features into bzrlib.tests.features

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    static_tuple,
27
27
    tests,
28
28
    )
 
29
from bzrlib.tests import (
 
30
    features,
 
31
    )
29
32
 
30
33
 
31
34
def load_tests(standard_tests, module, loader):
37
40
    return suite
38
41
 
39
42
 
40
 
class _Meliae(tests.Feature):
41
 
 
42
 
    def _probe(self):
43
 
        try:
44
 
            from meliae import scanner
45
 
        except ImportError:
46
 
            return False
47
 
        return True
48
 
 
49
 
    def feature_name(self):
50
 
        return "Meliae - python memory debugger"
51
 
 
52
 
Meliae = _Meliae()
53
 
 
54
 
 
55
43
class TestStaticTuple(tests.TestCase):
56
44
 
57
45
    def assertRefcount(self, count, obj):
444
432
        # amount of referenced memory. Unfortunately gc.get_referents() first
445
433
        # checks the IS_GC flag before it traverses anything. We could write a
446
434
        # helper func, but that won't work for the generic implementation...
447
 
        self.requireFeature(Meliae)
 
435
        self.requireFeature(features.meliae_feature)
448
436
        from meliae import scanner
449
437
        strs = ['foo', 'bar', 'baz', 'bing']
450
438
        k = self.module.StaticTuple(*strs)
455
443
        self.assertEqual(sorted(refs), sorted(scanner.get_referents(k)))
456
444
 
457
445
    def test_nested_referents(self):
458
 
        self.requireFeature(Meliae)
 
446
        self.requireFeature(features.meliae_feature)
459
447
        from meliae import scanner
460
448
        strs = ['foo', 'bar', 'baz', 'bing']
461
449
        k1 = self.module.StaticTuple(*strs[:2])