[U-Boot] [PATCH] Revert "test/py: Import 'configparser' lower case to be python 3.x safe"

Michal Simek michal.simek at xilinx.com
Thu Oct 4 07:37:46 UTC 2018


This reverts commit 052ca37daa20a9825d7ce905d632e349f434058d.
This patch introduced bug which hasn't been resolved for quite a long
time. Full failed log is placed below but the major sign is
"codec can't decode byte 0x80 in position".
This issue is at least on my Ubuntu 14.04 system but others reported
similar issue.

FAILED:
u_boot_console = <u_boot_console_exec_attach.ConsoleExecAttach object at
0x7f6020cc1950>

    def test_version(u_boot_console):
        """Test that the "version" command prints the U-Boot version."""

        # "version" prints the U-Boot sign-on message. This is usually
        # considered
        # an error, so that any unexpected reboot causes an error. Here,
        # this
        # error detection is disabled since the sign-on message is
        # expected.
        with u_boot_console.disable_check('main_signon'):
>           response = u_boot_console.run_command('version')

test/py/tests/test_000_version.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/py/u_boot_console_base.py:181: in run_command
    self.logstream.write(self.prompt, implicit=True)
test/py/multiplexed_log.py:65: in write
    self.logfile.write(self, data, implicit)
test/py/multiplexed_log.py:688: in write
    self.f.write(self._escape(data))
test/py/multiplexed_log.py:335: in _escape
    c for c in data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

.0 = <iterator object at 0x7f6020bce950>

    data = ''.join((c in self._nonprint) and ('%25%25%2502x' %25 ord(c))
or
>                  c for c in data)
E   UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position
32: ordinal not in range(128)

test/py/multiplexed_log.py:335: UnicodeDecodeError

Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

I am sending this revert because Marek also hit this issue on his PC.

---
 test/py/conftest.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 5c658b8c4840..e591f5879dcb 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -18,15 +18,11 @@ import os
 import os.path
 import pytest
 from _pytest.runner import runtestprotocol
+import ConfigParser
 import re
 import StringIO
 import sys
 
-try:
-    import configparser
-except:
-    import ConfigParser as configparser
-
 # Globals: The HTML log file, and the connection to the U-Boot console.
 log = None
 console = None
@@ -170,7 +166,7 @@ def pytest_configure(config):
         with open(dot_config, 'rt') as f:
             ini_str = '[root]\n' + f.read()
             ini_sio = StringIO.StringIO(ini_str)
-            parser = configparser.RawConfigParser()
+            parser = ConfigParser.RawConfigParser()
             parser.readfp(ini_sio)
             ubconfig.buildconfig.update(parser.items('root'))
 
-- 
1.9.1



More information about the U-Boot mailing list