class TestPathResolver(TestCase):
    def setUp(self):
        self.path_resolver = PathResolver(runtime="chitti2.0", binary="chitti")

    def test_inits(self):
        self.assertEqual(self.path_resolver.runtime, "chitti2.0")
        self.assertEqual(self.path_resolver.binary, "chitti")

    def test_which_fails(self):
        with self.assertRaises(ValueError):
            utils.which = lambda x: None
            self.path_resolver._which()

    def test_which_success_immediate(self):
        with mock.patch.object(self.path_resolver, "_which") as which_mock:
            which_mock.return_value = os.getcwd()
            self.assertEqual(self.path_resolver.exec_paths, os.getcwd())
Пример #2
0
 def get_resolvers(self):
     """
     Non specialized path resolver that just returns the list of executable for the runtime on the path.
     """
     return [
         PathResolver(runtime=self.runtime,
                      binary=self.CAPABILITY.language,
                      executable_search_paths=self.executable_search_paths)
     ]
 def setUp(self):
     self.path_resolver = PathResolver(runtime="chitti2.0", binary="chitti")
 def get_resolvers(self):
     return [
         PathResolver(runtime="provided",
                      binary="make",
                      executable_search_paths=self.executable_search_paths)
     ]
Пример #5
0
 def get_resolvers(self):
     """
     specialized path resolver that just returns the list of executable for the runtime on the path.
     """
     return [PathResolver(runtime=self.runtime, binary="npm")]