/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: John Ferlito
  • Date: 2009-09-02 04:31:45 UTC
  • mto: (4665.7.1 serve-init)
  • mto: This revision was merged to the branch mainline in revision 4913.
  • Revision ID: johnf@inodes.org-20090902043145-gxdsfw03ilcwbyn5
Add a debian init script for bzr --serve

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 io import BytesIO
18
 
 
 
17
from cStringIO import StringIO
19
18
 
20
19
class FakeReadFile(object):
21
20
    """A file-like object that can be given predefined content and read
23
22
 
24
23
    def __init__(self, data):
25
24
        """Initialize the mock file object with the provided data."""
26
 
        self.data = BytesIO(data)
 
25
        self.data = StringIO(data)
27
26
        self.max_read_size = None
28
27
        self.read_count = 0
29
28
 
31
30
        """Reads size characters from the input (or the rest of the string if
32
31
        size is -1)."""
33
32
        data = self.data.read(size)
34
 
        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))
35
34
        self.read_count += 1
36
35
        return data
37
36