From 3bde5e7de90ad6c90922c3e8500a60944c25e01c Mon Sep 17 00:00:00 2001 From: Pablo Greco Date: Jul 28 2019 18:55:41 +0000 Subject: Fix python-iniparse tests in CentOS8 --- diff --git a/tests/p_python-iniparse/0-install-python-iniparse.sh b/tests/p_python-iniparse/0-install-python-iniparse.sh index 98f61ca..789b391 100755 --- a/tests/p_python-iniparse/0-install-python-iniparse.sh +++ b/tests/p_python-iniparse/0-install-python-iniparse.sh @@ -4,4 +4,8 @@ # Install python-iniparse: required by yum so a quite important package in CentOS t_Log "Running $0 - installing python-iniparse." +if [ "$centos_ver" -ge 8 ] ; then +t_InstallPackage python3-iniparse +else t_InstallPackage python-iniparse +fi diff --git a/tests/p_python-iniparse/1-test-python-iniparse.sh b/tests/p_python-iniparse/1-test-python-iniparse.sh index 73887cd..848117d 100755 --- a/tests/p_python-iniparse/1-test-python-iniparse.sh +++ b/tests/p_python-iniparse/1-test-python-iniparse.sh @@ -3,6 +3,12 @@ t_Log "Running $0 - test python-iniparse" +if [ "$centos_ver" -ge 8 ] ; then +PYTHON=python3 +else +PYTHON=python +fi + TESTINI=`mktemp` # Test contents: a part of /etc/yum.conf @@ -14,12 +20,12 @@ debuglevel=2 logfile=/var/log/yum.log EOF -cat << EOF | python - $TESTINI | grep -q '/var/log/yum.log' +cat << EOF | $PYTHON - $TESTINI | grep -q '/var/log/yum.log' import sys from iniparse import INIConfig cfg = INIConfig(open(sys.argv[1])) -print cfg.main.logfile +print (cfg.main.logfile) EOF t_CheckExitStatus $? @@ -36,12 +42,12 @@ section3var1=val2 section3var2=val3 EOF -cat << EOF | python - $TESTINI | grep -q "\['section1', 'section2', 'section3'\] val1 val2 val3" +cat << EOF | $PYTHON - $TESTINI | grep -q "\['section1', 'section2', 'section3'\] val1 val2 val3" import sys from iniparse import INIConfig cfg = INIConfig(open(sys.argv[1])) -print str(list(cfg)) + ' ' + cfg.section1.section1var1 + ' ' + cfg.section3.section3var1 + ' ' + cfg.section3.section3var2 +print (str(list(cfg)) + ' ' + cfg.section1.section1var1 + ' ' + cfg.section3.section3var1 + ' ' + cfg.section3.section3var2) EOF t_CheckExitStatus $?