diff options
author | Paul Burton <paul.burton@imgtec.com> | 2017-09-14 14:34:45 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-07-10 14:50:50 -0600 |
commit | 052ca37daa20a9825d7ce905d632e349f434058d (patch) | |
tree | b95661139971b51cbb935f8589e6a84f0580ffe7 /test/py/conftest.py | |
parent | b8c455500a08c75c4809e523d348027e72cda7ec (diff) |
test/py: Import 'configparser' lower case to be python 3.x safe
In python 3.x the configparser module is named with all lower case.
Import it as such in order to avoid errors when running on python 3.x,
and fall back to the CamelCase version in order to keep working with
python 2.x.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'test/py/conftest.py')
-rw-r--r-- | test/py/conftest.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/py/conftest.py b/test/py/conftest.py index e591f5879d..5c658b8c48 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -18,11 +18,15 @@ 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 @@ -166,7 +170,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')) |