~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__static_tuple.py

(gz) Fix test failure on alpha by correcting format string for
 gc_chk_sha1_record (Martin [gz])

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
 
    )
32
29
 
33
30
 
34
31
def load_tests(standard_tests, module, loader):
40
37
    return suite
41
38
 
42
39
 
 
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
 
43
55
class TestStaticTuple(tests.TestCase):
44
56
 
45
57
    def assertRefcount(self, count, obj):
432
444
        # amount of referenced memory. Unfortunately gc.get_referents() first
433
445
        # checks the IS_GC flag before it traverses anything. We could write a
434
446
        # helper func, but that won't work for the generic implementation...
435
 
        self.requireFeature(features.meliae)
 
447
        self.requireFeature(Meliae)
436
448
        from meliae import scanner
437
449
        strs = ['foo', 'bar', 'baz', 'bing']
438
450
        k = self.module.StaticTuple(*strs)
443
455
        self.assertEqual(sorted(refs), sorted(scanner.get_referents(k)))
444
456
 
445
457
    def test_nested_referents(self):
446
 
        self.requireFeature(features.meliae)
 
458
        self.requireFeature(Meliae)
447
459
        from meliae import scanner
448
460
        strs = ['foo', 'bar', 'baz', 'bing']
449
461
        k1 = self.module.StaticTuple(*strs[:2])