def test_which_for_windows(self): with TemporaryDirectory() as tmp: os.environ["PATH"] = '%s:%s' % (os.environ["PATH"], tmp) exe_file = join(tmp,'mywin.exe') with open(exe_file,'w'): os.chmod(exe_file, stat.S_IXUSR) assert_equals(exe_file, which('mywin'))
def test_which_for_windows(self): with TemporaryDirectory() as tmp: os.environ["PATH"] = '%s:%s' % (os.environ["PATH"], tmp) exe_file = join(tmp, 'mywin.exe') with open(exe_file, 'w'): os.chmod(exe_file, stat.S_IXUSR) assert_equals(exe_file, which('mywin'))
def test_which(self): self.assertEquals('/bin/ls', which('ls')) self.assertEquals('/bin/ls', which('/bin/ls')) self.assertIsNone(which('blahblah'))
def test_which(self): assert_equals('/bin/ls', which('ls')) assert_equals('/bin/ls', which('/bin/ls')) assert_equals(None, which('blahblah'))