aboutsummaryrefslogtreecommitdiff
path: root/run_tests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-09-01 23:12:06 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2016-09-01 23:12:06 +0300
commitcdf0c4f1a945f1262ae604047fd240b25cf44050 (patch)
treeefb861fa017c1f8663b75570fe61fa644c2bd3d0 /run_tests.py
parent389259c229b30d38ec9de503dff965973b24ee26 (diff)
parent859c5e28df90851838aacc4b9ad49d3630e4992a (diff)
downloadmeson-cdf0c4f1a945f1262ae604047fd240b25cf44050.zip
meson-cdf0c4f1a945f1262ae604047fd240b25cf44050.tar.gz
meson-cdf0c4f1a945f1262ae604047fd240b25cf44050.tar.bz2
Merge branch 'QuLogic-context-managers'
Diffstat (limited to 'run_tests.py')
-rwxr-xr-xrun_tests.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/run_tests.py b/run_tests.py
index 3e49662..48f1230 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -156,8 +156,9 @@ def validate_install(srcdir, installdir):
if os.path.exists(os.path.join(installdir, noinst_file)):
expected[noinst_file] = False
elif os.path.exists(info_file):
- for line in open(info_file):
- expected[platform_fix_exe_name(line.strip())] = False
+ with open(info_file) as f:
+ for line in f:
+ expected[platform_fix_exe_name(line.strip())] = False
# Check if expected files were found
for fname in expected:
if os.path.exists(os.path.join(installdir, fname)):
@@ -249,7 +250,8 @@ def _run_test(testdir, test_build_dir, install_dir, extra_args, flags, compile_c
(returncode, stdo, stde) = run_configure_inprocess(gen_command)
try:
logfile = os.path.join(test_build_dir, 'meson-logs/meson-log.txt')
- mesonlog = open(logfile, errors='ignore').read()
+ with open(logfile, errors='ignore') as f:
+ mesonlog = f.read()
except Exception:
mesonlog = 'No meson-log.txt found.'
gen_time = time.time() - gen_start
@@ -401,7 +403,9 @@ def run_tests(extra_args):
def check_file(fname):
linenum = 1
- for line in open(fname, 'rb').readlines():
+ with open(fname, 'rb') as f:
+ lines = f.readlines()
+ for line in lines:
if b'\t' in line:
print("File %s contains a literal tab on line %d. Only spaces are permitted." % (fname, linenum))
sys.exit(1)