コード例 #1
0
 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)
コード例 #2
0
 def test_unlocatable(self, _mocked_find):
     with self.assertRaisesRegex(ValueError, "cannot find"):
         executables.get_executable_paths("diamond=wrong_alias")
コード例 #3
0
 def test_missing_abs_target(self, _mocked_exists):
     with self.assertRaisesRegex(ValueError, "no such file"):
         executables.get_executable_paths("diamond=/bad/path")
コード例 #4
0
 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"
コード例 #5
0
 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)