summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2016-06-12 08:40:20 +0200
committerStefan Behnel <stefan_ml@behnel.de>2016-07-15 08:19:22 +0200
commitdb2eb84f720596a0014d5673bdd23ffdb6b5d62a (patch)
treecc5f302488cb76a49a1a0d6df33ba2d597ceb269
parent41b7184c1f7c4b45240b8e333720fb56ee173a71 (diff)
downloadcython-db2eb84f720596a0014d5673bdd23ffdb6b5d62a.tar.gz
properly open and close source file in test runner when parsing distutils flags
-rwxr-xr-xruntests.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtests.py b/runtests.py
index c3286fcf3..a9424cfa0 100755
--- a/runtests.py
+++ b/runtests.py
@@ -850,8 +850,10 @@ class CythonCompileTestCase(unittest.TestCase):
if 'distutils' in self.tags:
from Cython.Build.Dependencies import DistutilsInfo
+ from Cython.Utils import open_source_file
pyx_path = os.path.join(self.test_directory, self.module + ".pyx")
- DistutilsInfo(open(pyx_path)).apply(extension)
+ with open_source_file(pyx_path) as f:
+ DistutilsInfo(f).apply(extension)
for matcher, fixer in list(EXT_EXTRAS.items()):
if isinstance(matcher, str):