Index: test/preparser/testcfg.py |
diff --git a/test/preparser/testcfg.py b/test/preparser/testcfg.py |
index c534fa1cf507e382ba09ebeab792b4b315643006..39b62c396de4c304d5b4c33b60463a45f45d86ab 100644 |
--- a/test/preparser/testcfg.py |
+++ b/test/preparser/testcfg.py |
@@ -98,6 +98,7 @@ class PreparserTestConfiguration(test.TestConfiguration): |
def ParsePythonTestTemplates(self, result, filename, |
executable, current_path, mode): |
pathname = join(self.root, filename + ".pyt") |
+ source = open(pathname).read(); |
def Test(name, source, expectation): |
throws = None |
if (expectation is not None): |
@@ -117,7 +118,8 @@ class PreparserTestConfiguration(test.TestConfiguration): |
testsource = testsource.replace("$"+key, replacement[key]); |
Test(testname, testsource, expectation) |
return MkTest |
- execfile(pathname, {"Test": Test, "Template": Template}) |
+ eval(compile(source, pathname, "exec"), |
+ {"Test": Test, "Template": Template}, {}) |
def ListTests(self, current_path, path, mode, variant_flags): |
executable = join('obj', 'preparser', mode, 'preparser') |
@@ -141,9 +143,9 @@ class PreparserTestConfiguration(test.TestConfiguration): |
filenames.sort() |
for file in filenames: |
# Each file as a python source file to be executed in a specially |
- # created environment (defining the Template and Test functions) |
+ # perparsed environment (defining the Template and Test functions) |
self.ParsePythonTestTemplates(result, file, |
- executable, current_path, mode) |
+ executable, current_path, mode) |
return result |
def GetTestStatus(self, sections, defs): |