/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/file_utils.py

  • Committer: Marius Kruger
  • Date: 2010-07-10 21:28:56 UTC
  • mto: (5384.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5385.
  • Revision ID: marius.kruger@enerweb.co.za-20100710212856-uq4ji3go0u5se7hx
* Update documentation
* add NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from ..sixish import (
18
 
    BytesIO,
19
 
    )
20
 
 
 
17
from cStringIO import StringIO
21
18
 
22
19
class FakeReadFile(object):
23
20
    """A file-like object that can be given predefined content and read
25
22
 
26
23
    def __init__(self, data):
27
24
        """Initialize the mock file object with the provided data."""
28
 
        self.data = BytesIO(data)
 
25
        self.data = StringIO(data)
29
26
        self.max_read_size = None
30
27
        self.read_count = 0
31
28
 
33
30
        """Reads size characters from the input (or the rest of the string if
34
31
        size is -1)."""
35
32
        data = self.data.read(size)
36
 
        self.max_read_size = max(self.max_read_size or 0, len(data))
 
33
        self.max_read_size = max(self.max_read_size, len(data))
37
34
        self.read_count += 1
38
35
        return data
39
36