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

Paul Burton paul.burton at imgtec.com
Thu Sep 14 20:06:29 UTC 2017


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 at imgtec.com>
---

 test/py/conftest.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index ced96f1006..dc444cc866 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -19,11 +19,15 @@ import os
 import os.path
 import pytest
 from _pytest.runner import runtestprotocol
-import ConfigParser
 import re
 import StringIO
 import sys
 
+try:
+    import configparser as ConfigParser
+except:
+    import ConfigParser
+
 # Globals: The HTML log file, and the connection to the U-Boot console.
 log = None
 console = None
-- 
2.14.1



More information about the U-Boot mailing list