def testUnix(self): self.assertEqual(util.which('/bin/sh'), '/bin/sh') self.assertIsNone(util.which('xxx')) self.assertIsNotNone(util.which('cat'))
def testWindows(self): notepad_path = 'C:\\Windows\\System32\\notepad.exe' self.assertEqual(util.which(notepad_path), notepad_path) self.assertIsNone(util.which('xxx')) self.assertIsNotNone(util.which('notepad.exe'))