/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/__init__.py

  • Committer: Andrew Bennetts
  • Date: 2011-05-27 06:39:06 UTC
  • mto: This revision was merged to the branch mainline in revision 5946.
  • Revision ID: andrew.bennetts@canonical.com-20110527063906-0w772t135kxuwfpf
Use testtools' content_from_file helper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2068
2068
                # multiple details with the same key (either wasting effort if
2069
2069
                # the log file is the same or losing info if the log files are
2070
2070
                # different).
2071
 
                try:
2072
 
                    with open(subproc_bzr_log, "rb") as log_file:
2073
 
                        log_text = log_file.read()
2074
 
                except (IOError, OSError) as err:
2075
 
                    log_text = ('Could not read log file: %s' %
2076
 
                        unicode(err).encode('utf8'))
 
2071
                # We use buffer_now=True to avoid holding the file open beyond
 
2072
                # the life of this function, which might interfere with e.g.
 
2073
                # cleaning tempdirs on Windows.
2077
2074
                self.addDetail("start_bzr_subprocess-log",
2078
 
                    content.Content(content.ContentType("text", "plain",
2079
 
                        {"charset": "utf8"}), lambda: [log_text]))
 
2075
                    content.content_from_file(subproc_bzr_log,
 
2076
                        buffer_now=True))
2080
2077
            self.addCleanup(addLogDetail)
2081
2078
 
2082
2079
            command = [sys.executable]