~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__static_tuple.py

  • Committer: Kit Randel
  • Date: 2014-12-15 20:24:42 UTC
  • mto: This revision was merged to the branch mainline in revision 6602.
  • Revision ID: kit.randel@canonical.com-20141215202442-usf2ixhypqg8yh6q
added a note for bug-1400567 to the 2.7b release notes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009, 2010, 2011 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
17
17
"""Tests for the StaticTuple type."""
18
18
 
19
19
import cPickle
20
 
import gc
21
20
import sys
22
21
 
23
22
from bzrlib import (
24
23
    _static_tuple_py,
25
24
    debug,
26
 
    errors,
27
25
    osutils,
28
26
    static_tuple,
29
27
    tests,
30
28
    )
 
29
from bzrlib.tests import (
 
30
    features,
 
31
    )
31
32
 
32
33
 
33
34
def load_tests(standard_tests, module, loader):
39
40
    return suite
40
41
 
41
42
 
42
 
class _Meliae(tests.Feature):
43
 
 
44
 
    def _probe(self):
45
 
        try:
46
 
            from meliae import scanner
47
 
        except ImportError:
48
 
            return False
49
 
        return True
50
 
 
51
 
    def feature_name(self):
52
 
        return "Meliae - python memory debugger"
53
 
 
54
 
Meliae = _Meliae()
55
 
 
56
 
 
57
43
class TestStaticTuple(tests.TestCase):
58
44
 
59
45
    def assertRefcount(self, count, obj):
446
432
        # amount of referenced memory. Unfortunately gc.get_referents() first
447
433
        # checks the IS_GC flag before it traverses anything. We could write a
448
434
        # helper func, but that won't work for the generic implementation...
449
 
        self.requireFeature(Meliae)
 
435
        self.requireFeature(features.meliae)
450
436
        from meliae import scanner
451
437
        strs = ['foo', 'bar', 'baz', 'bing']
452
438
        k = self.module.StaticTuple(*strs)
457
443
        self.assertEqual(sorted(refs), sorted(scanner.get_referents(k)))
458
444
 
459
445
    def test_nested_referents(self):
460
 
        self.requireFeature(Meliae)
 
446
        self.requireFeature(features.meliae)
461
447
        from meliae import scanner
462
448
        strs = ['foo', 'bar', 'baz', 'bing']
463
449
        k1 = self.module.StaticTuple(*strs[:2])