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

Side by Side Diff: recipe_engine/test.py

Issue 2845923002: [recipes.py] use argparse to set command automatically. (Closed)
Patch Set: rebase Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « recipe_engine/run.py ('k') | recipes.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The LUCI Authors. All rights reserved. 1 # Copyright 2017 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 from __future__ import print_function 5 from __future__ import print_function
6 6
7 import bdb 7 import bdb
8 import cStringIO 8 import cStringIO
9 import contextlib 9 import contextlib
10 import copy 10 import copy
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 '--filter', action='append', type=normalize_filter, 915 '--filter', action='append', type=normalize_filter,
916 help=glob_helpstr) 916 help=glob_helpstr)
917 917
918 def postprocess_func(_parser, args): 918 def postprocess_func(_parser, args):
919 # Auto-enable bootstrap for test command invocations (necessary to get 919 # Auto-enable bootstrap for test command invocations (necessary to get
920 # recent enough version of coverage package), unless explicitly disabled. 920 # recent enough version of coverage package), unless explicitly disabled.
921 if args.use_bootstrap is None: 921 if args.use_bootstrap is None:
922 args.use_bootstrap = True 922 args.use_bootstrap = True
923 923
924 test_p.set_defaults( 924 test_p.set_defaults(
925 command='test', func=main, 925 func=main, postprocess_func=postprocess_func,
926 postprocess_func=postprocess_func,
927 ) 926 )
928 927
929 928
930 def main(package_deps, args): 929 def main(package_deps, args):
931 """Runs simulation tests on a given repo of recipes. 930 """Runs simulation tests on a given repo of recipes.
932 931
933 Args: 932 Args:
934 package_deps (PackageDeps) 933 package_deps (PackageDeps)
935 args: the parsed args (see add_subparser). 934 args: the parsed args (see add_subparser).
936 Returns: 935 Returns:
937 Exit code 936 Exit code
938 """ 937 """
939 universe = loader.RecipeUniverse(package_deps, args.package) 938 universe = loader.RecipeUniverse(package_deps, args.package)
940 universe_view = loader.UniverseView(universe, package_deps.root_package) 939 universe_view = loader.UniverseView(universe, package_deps.root_package)
941 engine_flags=args.operational_args.engine_flags 940 engine_flags=args.operational_args.engine_flags
942 941
943 # Prevent flakiness caused by stale pyc files. 942 # Prevent flakiness caused by stale pyc files.
944 package.cleanup_pyc(package_deps.root_package.recipes_dir) 943 package.cleanup_pyc(package_deps.root_package.recipes_dir)
945 944
946 global _UNIVERSE_VIEW 945 global _UNIVERSE_VIEW
947 _UNIVERSE_VIEW = universe_view 946 _UNIVERSE_VIEW = universe_view
948 global _ENGINE_FLAGS 947 global _ENGINE_FLAGS
949 _ENGINE_FLAGS = engine_flags 948 _ENGINE_FLAGS = engine_flags
950 949
951 return args.subfunc(args) 950 return args.subfunc(args)
OLDNEW
« no previous file with comments | « recipe_engine/run.py ('k') | recipes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698