def _find_weka(): """ Look for Weka installation in system $PATH or /Applications. If not found, return None. """ mac_path = '/Applications/Weka.app' linux_path = system.which('weka') return mac_path if fs.exists(mac_path) else linux_path
def test_which_path(self): self._test("/bin/sh", system.which("sh", path=("/usr", "/bin"))) self._test(None, system.which("sh", path=("/dev",))) self._test(None, system.which("sh", path=("/not-a-real-path",))) self._test(None, system.which("not-a-real-command", path=("/bin",)))
def test_which(self): self._test("/bin/sh", system.which("sh")) self._test(None, system.which("not-a-real-command"))
def test_which_path(): assert system.which("sh", path=("/usr", "/bin")) == "/bin/sh" assert not system.which("sh", path=("/dev",)) assert not system.which("sh", path=("/not-a-real-path",)) assert not system.which("not-a-real-command", path=("/bin",))
def test_which(): assert "/bin/sh" == system.which("sh") assert not system.which("not-a-real-command")