def test_does_not_find_executable(self): exists = FakeExists(['/bin/foo']) with patch(self.exists_module, exists): path = remotes.which('ls') assert path is None
def test_finds_absolute_paths(self): exists = FakeExists(['/bin/ls']) with patch(self.exists_module, exists): path = remotes.which('ls') assert path == '/bin/ls'
def test_executable_exists_as_file(self, monkeypatch): monkeypatch.setattr(remotes.os.path, 'exists', lambda x: True) monkeypatch.setattr(remotes.os.path, 'isfile', lambda x: True) assert remotes.which('foo') == '/usr/local/bin/foo'
def test_executable_does_not_exist(self, monkeypatch): monkeypatch.setattr(remotes.os.path, 'exists', lambda x: False) monkeypatch.setattr(remotes.os.path, 'isfile', lambda x: True) assert remotes.which('foo') is None