diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-19 03:19:13 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-19 03:49:31 +0530 |
commit | 7e805a019ae4d923403af8032776c0c302e3a50c (patch) | |
tree | f235ff5c0039b8e43469dce0d9606bb30a722595 /run_unittests.py | |
parent | 280346da3ac5904ec097afe89ef45ad34bd4a173 (diff) | |
download | meson-7e805a019ae4d923403af8032776c0c302e3a50c.zip meson-7e805a019ae4d923403af8032776c0c302e3a50c.tar.gz meson-7e805a019ae4d923403af8032776c0c302e3a50c.tar.bz2 |
find_program: Fix implementation of .path()
And actually test that prog.path() works. The earlier test was just
running the command without checking if it succeeded.
Also make everything use prog.get_command() or get_path() instead of
accessing the internal member prog.fullpath directly.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/run_unittests.py b/run_unittests.py index f72313a..95e52e3 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -585,9 +585,9 @@ class WindowsTests(BasePlatformTests): self.assertTrue(prog1.found(), msg='cmd not found') prog2 = ExternalProgram('cmd.exe') self.assertTrue(prog2.found(), msg='cmd.exe not found') - self.assertPathEqual(prog1.fullpath[0], prog2.fullpath[0]) + self.assertPathEqual(prog1.get_path(), prog2.get_path()) # Find cmd with an absolute path that's missing the extension - cmd_path = prog2.fullpath[0][:-4] + cmd_path = prog2.get_path()[:-4] prog = ExternalProgram(cmd_path) self.assertTrue(prog.found(), msg='{!r} not found'.format(cmd_path)) # Finding a script with no extension inside a directory works @@ -600,13 +600,13 @@ class WindowsTests(BasePlatformTests): 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.fullpath[0], sys.executable) - self.assertPathBasenameEqual(prog.fullpath[1], 'test-script-ext.py') + self.assertPathEqual(prog.get_command()[0], sys.executable) + 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') - self.assertPathEqual(prog.fullpath[0], sys.executable) - self.assertPathBasenameEqual(prog.fullpath[1], 'test-script-ext.py') + self.assertPathEqual(prog.get_command()[0], sys.executable) + self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py') class LinuxlikeTests(BasePlatformTests): |