Skip to content

Commit 7f1f613

Browse files
ligurioTotktonada
andcommitted
python3: fix configparser module import
Part of #20 Co-authored-by: Alexander Turenko <[email protected]>
1 parent a06d84a commit 7f1f613

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/test_suite.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
import ConfigParser
1+
from __future__ import print_function
2+
from __future__ import absolute_import
3+
4+
from six.moves import configparser
5+
import six
6+
7+
if six.PY2:
8+
# Python2
9+
ConfigParser = configparser.SafeConfigParser
10+
else:
11+
# Python3
12+
ConfigParser = configparser.ConfigParser
13+
214
import json
315
import os
416
import re
@@ -90,7 +102,7 @@ def __init__(self, suite_path, args):
90102
raise RuntimeError("Suite %s doesn't exist" % repr(suite_path))
91103

92104
# read the suite config
93-
config = ConfigParser.ConfigParser()
105+
config = configparser.ConfigParser()
94106
config.read(os.path.join(suite_path, "suite.ini"))
95107
self.ini.update(dict(config.items("default")))
96108
self.ini.update(self.args.__dict__)

0 commit comments

Comments
 (0)