aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-06-08 12:06:29 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2017-06-08 16:17:20 +0300
commitde1305c9e8034245f1b6237a8db90fe349a9f616 (patch)
treeadfb4695d01a94a90d2dd1befe1349ab0a7a5f17
parent4ed68e7934e7d8a126c896593bb783b753d41d82 (diff)
downloadmeson-de1305c9e8034245f1b6237a8db90fe349a9f616.zip
meson-de1305c9e8034245f1b6237a8db90fe349a9f616.tar.gz
meson-de1305c9e8034245f1b6237a8db90fe349a9f616.tar.bz2
Do not use context managers. Because Windows.
-rwxr-xr-xrun_unittests.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 496c6bc..8a9ac0a 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -358,21 +358,28 @@ class InternalTests(unittest.TestCase):
'cpu': '\'armv7\'',
'endian': '\'little\'',
}
-
- with tempfile.NamedTemporaryFile(mode='w+') as configfile:
- config.write(configfile)
- configfile.flush()
- detected_value = mesonbuild.environment.CrossBuildInfo(configfile.name).need_exe_wrapper()
+ # Can not be used as context manager because we need to
+ # open it a second time and this is not possible on
+ # Windows.
+ configfile = tempfile.NamedTemporaryFile(mode='w+', delete=False)
+ configfilename = configfile.name
+ config.write(configfile)
+ configfile.flush()
+ configfile.close()
+ detected_value = mesonbuild.environment.CrossBuildInfo(configfile.name).need_exe_wrapper()
+ os.unlink(configfilename)
desired_value = not detected_value
config['properties'] = {
'needs_exe_wrapper': 'true' if desired_value else 'false'
}
- with tempfile.NamedTemporaryFile(mode='w+') as configfile:
- config.write(configfile)
- configfile.flush()
- forced_value = mesonbuild.environment.CrossBuildInfo(configfile.name).need_exe_wrapper()
+ configfile = tempfile.NamedTemporaryFile(mode='w+', delete=False)
+ configfilename = configfile.name
+ config.write(configfile)
+ configfile.close()
+ forced_value = mesonbuild.environment.CrossBuildInfo(configfile.name).need_exe_wrapper()
+ os.unlink(configfilename)
self.assertEqual(forced_value, desired_value)