From fd31fc172c626bdac2afd8af9f8482bfc21a5501 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 24 Oct 2019 11:59:21 -0400 Subject: test/py: Manual python3 fixes - 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 Reviewed-by: Simon Glass Tested-by: Stephen Warren Tested-by: Simon Glass [on sandbox] Signed-off-by: Tom Rini --- test/py/conftest.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'test/py/conftest.py') diff --git a/test/py/conftest.py b/test/py/conftest.py index 5c19af1d50..bffee6b8a3 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -13,17 +13,16 @@ # - Implementing custom pytest markers. import atexit +import configparser import errno +import io import os import os.path import pytest -from _pytest.runner import runtestprotocol import re -import io +from _pytest.runner import runtestprotocol import sys -import configparser - # Globals: The HTML log file, and the connection to the U-Boot console. log = None console = None @@ -168,7 +167,7 @@ def pytest_configure(config): ini_str = '[root]\n' + f.read() ini_sio = io.StringIO(ini_str) parser = configparser.RawConfigParser() - parser.readfp(ini_sio) + parser.read_file(ini_sio) ubconfig.buildconfig.update(parser.items('root')) ubconfig.test_py_dir = test_py_dir -- cgit v1.2.3