def test_duplicated(self, _mocked_find, _mocked_exists): paths = ["diamond=some_alias", "diamond=/some/abs/path"] for direction in [1, -1]: arg = ",".join(paths[::direction]) with self.assertRaisesRegex(ValueError, "multiple paths specified"): executables.get_executable_paths(arg)
def test_unlocatable(self, _mocked_find): with self.assertRaisesRegex(ValueError, "cannot find"): executables.get_executable_paths("diamond=wrong_alias")
def test_missing_abs_target(self, _mocked_exists): with self.assertRaisesRegex(ValueError, "no such file"): executables.get_executable_paths("diamond=/bad/path")
def test_duplicated_but_same_value(self, _mocked_find, _mocked_exists): paths = ["diamond=alt_diamond", "diamond=/abs/path/alt_diamond"] for direction in [1, -1]: arg = ",".join(paths[::direction]) assert executables.get_executable_paths( arg)["diamond"] == "/abs/path/alt_diamond"
def test_bad_formats(self): for bad in ["a", "a=", "=a", "a=a=", "a=a=a"]: with self.assertRaisesRegex(ValueError, "invalid .* format"): executables.get_executable_paths(bad)