[U-Boot] [PATCHv2 06/13] test/py: Manual python3 fixes
Tom Rini
trini at konsulko.com
Wed Oct 23 19:01:51 UTC 2019
On Wed, Oct 23, 2019 at 12:50:12PM -0600, Stephen Warren wrote:
> On 10/22/19 9:20 PM, Tom Rini wrote:
> > - Modern pytest is more visible in telling us about parameters that we
> > had not described, so describe a few more.
> > - ConfigParser.readfp(...) is now configparser.read_file(...)
> > - As part of the "strings vs bytes" conversions in Python 3, we use the
> > default encoding/decoding of utf-8 but in some places tell Python to
> > replace problematic conversions rather than throw a fatal error.
> > - Fix a typo noticed while doing the above ("tot he" -> "to the").
> > - As suggested by Stephen, re-alphabetize the import list
> > - Per Heinrich, replace how we write contents in test_fit.py
>
> > diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
>
> > @@ -133,7 +134,7 @@ class RunAndLog(object):
> > self.logfile.write(self, msg)
> > try:
> > - p = subprocess.Popen(cmd, cwd=cwd,
> > + p = subprocess.Popen(cmd, cwd=cwd, encoding="utf-8",
>
> The encoding parameter was added in Python 3.6, so this change causes
> test.py to crash for me (with Python 3.5.2). The following will fix that:
Right, Ubuntu 16.04 has Python 3.5.x and later has 3.6 or higher. It's
reasonable to ask what the minimum host version is going to be and how
much overhead things get the lower we go. Given:
> > p = subprocess.Popen(cmd, cwd=cwd,
> > stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
> > (stdout, stderr) = p.communicate()
> > if stdout is not None:
> > stdout = stdout.decode('utf-8')
> > if stderr is not None:
> > stderr = stderr.decode('utf-8')
That's not too bad, so we can go with that. Can you please chime in on
the "Minimum Python 3 version?" thread with what I assume is your
use-case of needing to use older-than-latest-LTS distributions?
> I also noticed that a variety of strings in these patches use "" not '' in
> at least this patch. When I first wrote test/py, Simon made me go through
> everything and replace "" with '', so we should probably make new code
> follow the convention of using ''.
OK, I'll get on top of that, thanks.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191023/a85257a0/attachment.sig>
More information about the U-Boot
mailing list