~xubuntu-dev/ubiquity/lp1437180_feh

« back to all changes in this revision

Viewing changes to tests/test_gtkui.py

  • Committer: Colin Watson
  • Date: 2012-05-03 12:26:22 UTC
  • Revision ID: cjwatson@canonical.com-20120503122622-1pqng262csumnswx
As a general rule, open subprocesses with universal_newlines=True when
expecting to read text from them.  This has no effect on Python 2
(aside from \r\n conversion and the like, which is mostly a no-op for
us), but causes Python 3 to read str rather than bytes.  The
exceptions at the moment are debconf-communicator subprocesses, where
debconf expects to read binary data and deal with encoding itself, and
debconf-copydb subprocesses, which return mixed-encoding data that
needs to be handled specially.

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
                ]
124
124
            deb_host_arch = subprocess.Popen(
125
125
                ['dpkg-architecture', '-qDEB_HOST_ARCH'],
126
 
                stdout=subprocess.PIPE).communicate()[0].strip()
 
126
                stdout=subprocess.PIPE,
 
127
                universal_newlines=True).communicate()[0].strip()
127
128
            if deb_host_arch not in ('amd64', 'i386'):
128
129
                # grub-installer not available, but this template won't be
129
130
                # displayed anyway.