run-test: drop 'execfile' usage for 'common-pattern.py' file

This is required for Python 3.
This commit is contained in:
Boris Feld 2017-11-19 04:11:21 +01:00
parent 892a48dd6e
commit 36f8a40cbc

View File

@ -973,8 +973,11 @@ class Test(unittest.TestCase):
if os.path.exists(replacementfile): if os.path.exists(replacementfile):
data = {} data = {}
execfile(replacementfile, data) with open(replacementfile, mode='rb') as source:
r.extend(data.get('substitutions', ())) # the intermediate 'compile' step help with debugging
code = compile(source.read(), replacementfile, 'exec')
exec(code, data)
r.extend(data.get('substitutions', ()))
return r return r
def _escapepath(self, p): def _escapepath(self, p):