~bzr/ubuntu/lucid/bzr/beta-ppa

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__bencode.py

  • Committer: Max Bowsher
  • Date: 2011-02-09 04:08:25 UTC
  • mfrom: (0.5074.6 lucid)
  • Revision ID: maxb@f2s.com-20110209040825-7jqm4i78b8ojoy9z
Merge beta-ppa into ppa upon release of 2.3.0.

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
 
19
21
from bzrlib import tests
20
22
 
21
23
def load_tests(standard_tests, module, loader):
105
107
                            'd8:spam.mp3d6:author5:Alice6:lengthi100000eee')
106
108
 
107
109
    def test_dict_deepnested(self):
108
 
        self._run_check_error(RuntimeError, ("d0:" * 10000) + 'i1e' + ("e" * 10000))
 
110
        # The recursion here provokes CPython into emitting a warning on
 
111
        # stderr, "maximum recursion depth exceeded in __subclasscheck__", due
 
112
        # to running out of stack space while evaluating "except (...):" in
 
113
        # _bencode_py.  This is harmless, so we temporarily override stderr to
 
114
        # avoid distracting noise in the test output.
 
115
        self.overrideAttr(sys, 'stderr', self._log_file)
 
116
        self._run_check_error(
 
117
            RuntimeError, ("d0:" * 10000) + 'i1e' + ("e" * 10000))
109
118
 
110
119
    def test_malformed_dict(self):
111
120
        self._run_check_error(ValueError, 'd')