~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__bencode.py

  • Committer: Andrew Bennetts
  • Date: 2010-09-17 04:21:12 UTC
  • mto: This revision was merged to the branch mainline in revision 5433.
  • Revision ID: andrew.bennetts@canonical.com-20100917042112-om1esqy5mhl6r36d
Suppress 'maximum recursion depth exceeded in __subclasscheck__' warning triggered by test__bencode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for bencode structured encoding"""
18
18
 
 
19
import sys
 
20
from cStringIO import StringIO
 
21
 
19
22
from bzrlib import tests
20
23
 
21
24
def load_tests(standard_tests, module, loader):
105
108
                            'd8:spam.mp3d6:author5:Alice6:lengthi100000eee')
106
109
 
107
110
    def test_dict_deepnested(self):
 
111
        # The recursion here provokes CPython into emitting a warning on
 
112
        # stderr, "maximum recursion depth exceeded in __subclasscheck__", due
 
113
        # to running out of stack space while evaluating "except (...):" in
 
114
        # _bencode_py.  This is harmless, so we temporarily override stderr to
 
115
        # avoid distracting noise in the test output.
 
116
        self.overrideAttr(sys, 'stderr', StringIO())
108
117
        self._run_check_error(RuntimeError, ("d0:" * 10000) + 'i1e' + ("e" * 10000))
109
118
 
110
119
    def test_malformed_dict(self):