def testBuildtoolsInGclientRoot(self): self.make_file_tree({'.gclient': '', 'buildtools': ''}) self.cwd = os.path.join(self.root, 'src', 'foo') self.assertEqual( os.path.join(self.root, 'buildtools'), gclient_paths.GetBuildtoolsPath())
def FindClangFormatScriptInChromiumTree(script_name): """Return a path to a clang-format helper script, or die trying.""" tools_path = gclient_paths.GetBuildtoolsPath() if not tools_path: raise NotFoundError( 'Could not find checkout in any parent of the current path.\n', 'Set CHROMIUM_BUILDTOOLS_PATH to use outside of a chromium checkout.') script_path = os.path.join(tools_path, 'clang_format', 'script', script_name) if not os.path.exists(script_path): raise NotFoundError('File does not exist: %s' % script_path) return script_path
def testNoBuildtools(self): self.make_file_tree({'.gclient': ''}) self.cwd = os.path.join(self.root, 'foo', 'bar') self.assertIsNone(gclient_paths.GetBuildtoolsPath())
def testNoSolutionsFound(self): self.cwd = os.path.join(self.root, 'foo', 'bar') subprocess2.check_output.side_effect = EXCEPTION self.assertIsNone(gclient_paths.GetBuildtoolsPath())
def testEnvVarOverride(self): os.environ = {'CHROMIUM_BUILDTOOLS_PATH': 'foo'} self.assertEqual('foo', gclient_paths.GetBuildtoolsPath())