diff options
author | Aleksey Gurtovoy <agurtovoy@acm.org> | 2019-06-26 17:48:43 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-06-27 21:30:34 +0300 |
commit | 7423247413b646366ed6265322fb9952d2bee0ef (patch) | |
tree | 1f7ca76d335a5943ef03ab3b5d7632da5a8fee0a /run_unittests.py | |
parent | 77c3e6a4aaed07e626f4bf4deb7eb66e0f03a33d (diff) | |
download | meson-7423247413b646366ed6265322fb9952d2bee0ef.zip meson-7423247413b646366ed6265322fb9952d2bee0ef.tar.gz meson-7423247413b646366ed6265322fb9952d2bee0ef.tar.bz2 |
Fix failing test_find_program test (Windows-only)
Skip finding a .py script w/o extension on Windows if `.PY` isn't in
PATHEXT; closes #4355
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/run_unittests.py b/run_unittests.py index 6934bc3..602c6b7 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4004,12 +4004,15 @@ class WindowsTests(BasePlatformTests): # Finding a script with an extension inside a directory works prog = ExternalProgram(os.path.join(testdir, 'test-script-ext.py')) self.assertTrue(prog.found(), msg='test-script-ext.py not found') - # Finding a script in PATH w/o extension works and adds the interpreter + # Finding a script in PATH os.environ['PATH'] += os.pathsep + testdir - prog = ExternalProgram('test-script-ext') - self.assertTrue(prog.found(), msg='test-script-ext not found in PATH') - self.assertPathEqual(prog.get_command()[0], python_command[0]) - self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py') + # Finding a script in PATH w/o extension works and adds the interpreter + # (check only if `.PY` is in PATHEXT) + if '.PY' in [ext.upper() for ext in os.environ['PATHEXT'].split(';')]: + prog = ExternalProgram('test-script-ext') + self.assertTrue(prog.found(), msg='test-script-ext not found in PATH') + self.assertPathEqual(prog.get_command()[0], python_command[0]) + self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py') # Finding a script in PATH with extension works and adds the interpreter prog = ExternalProgram('test-script-ext.py') self.assertTrue(prog.found(), msg='test-script-ext.py not found in PATH') |