Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Unified Diff: scripts/slave/recipe_modules/crrev/resources/crrev_client.py

Issue 1796993002: Fix crrev and add test coverage for the main function. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/crrev/resources/crrev_client_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_modules/crrev/resources/crrev_client.py
diff --git a/scripts/slave/recipe_modules/crrev/resources/crrev_client.py b/scripts/slave/recipe_modules/crrev/resources/crrev_client.py
index 9987fc7bebc99c7aca0ee1fe6c7b6991c60a038a..424bef78e9bbbddb61c3c1b10d03b2836b6acf8e 100755
--- a/scripts/slave/recipe_modules/crrev/resources/crrev_client.py
+++ b/scripts/slave/recipe_modules/crrev/resources/crrev_client.py
@@ -61,17 +61,17 @@ def crrev_get(path, params, attempts):
retry_delay_seconds *= 2
-def main():
+def main(args):
parser = argparse.ArgumentParser()
parser.add_argument('path', help='Path + query to add onto the base URL.')
parser.add_argument('--params-file', help='Request parameter JSON file.')
parser.add_argument('--attempts', default=1, help='Number of times to retry.')
- args = parser.parse_args()
+ args = parser.parse_args(args)
params = {}
if args.params_file:
- params = json.lad(args.params_file)
- print json.dumps(crrev_get(args.path, params, args.attempts), indent=2)
+ params = json.load(open(args.params_file))
+ return json.dumps(crrev_get(args.path, params, args.attempts), indent=2)
if __name__ == '__main__':
- main()
+ print main(sys.argv[1:])
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/crrev/resources/crrev_client_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698