meson command tests: clean up temporary script upon completion

pull/13720/head
Andrew McNulty 2 months ago committed by Dylan Baker
parent 5102f43657
commit bc30d5982d
  1. 2
      run_meson_command_tests.py

@ -206,13 +206,13 @@ class CommandTests(unittest.TestCase):
with open(script_file, 'w') as f: with open(script_file, 'w') as f:
f.write('#!/usr/bin/env python3\n\n') f.write('#!/usr/bin/env python3\n\n')
f.write(f'{test_command}\n') f.write(f'{test_command}\n')
self.addCleanup(os.remove, script_file)
for cmd in [['-c', test_command, 'fake argument'], [script_file, 'fake argument']]: for cmd in [['-c', test_command, 'fake argument'], [script_file, 'fake argument']]:
pyout = self._run(python_command + cmd) pyout = self._run(python_command + cmd)
mesonout = self._run(python_command + [meson_command, 'runpython'] + cmd, env=env) mesonout = self._run(python_command + [meson_command, 'runpython'] + cmd, env=env)
self.assertEqual(pyout, mesonout) self.assertEqual(pyout, mesonout)
if __name__ == '__main__': if __name__ == '__main__':
print('Meson build system', meson_version, 'Command Tests') print('Meson build system', meson_version, 'Command Tests')
raise SystemExit(unittest.main(buffer=True)) raise SystemExit(unittest.main(buffer=True))

Loading…
Cancel
Save