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

Unified Diff: tools/telemetry/telemetry/core/command_line.py

Issue 395133005: [telemetry] Let main() take args as a parameter in addition to command-line. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/command_line.py
diff --git a/tools/telemetry/telemetry/core/command_line.py b/tools/telemetry/telemetry/core/command_line.py
index 9652cc325f4465a5507e8c37fef6257238ce8972..450cd0d8076f3403debab527f19a20734735dd84 100644
--- a/tools/telemetry/telemetry/core/command_line.py
+++ b/tools/telemetry/telemetry/core/command_line.py
@@ -46,13 +46,13 @@ class Command(ArgumentHandlerMixIn):
raise NotImplementedError()
@classmethod
- def main(cls):
+ def main(cls, args=None):
"""Main method to run this command as a standalone script."""
parser = argparse.ArgumentParser()
cls.AddCommandLineArgs(parser)
- args = parser.parse_args()
+ args = parser.parse_args(args=args)
cls.ProcessCommandLineArgs(parser, args)
- return cls().Run(args)
+ return min(cls().Run(args), 255)
# TODO: Convert everything to argparse.
@@ -68,14 +68,14 @@ class OptparseCommand(Command):
raise NotImplementedError()
@classmethod
- def main(cls):
+ def main(cls, args=None):
"""Main method to run this command as a standalone script."""
parser = cls.CreateParser()
cls.AddCommandLineArgs(parser)
- options, args = parser.parse_args()
+ options, args = parser.parse_args(args=args)
options.positional_args = args
cls.ProcessCommandLineArgs(parser, options)
- return cls().Run(options)
+ return min(cls().Run(options), 255)
class SubcommandCommand(Command):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698