OLD | NEW |
---|---|
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 argparse | 7 import argparse |
8 import bdb | 8 import bdb |
9 import cStringIO | 9 import cStringIO |
10 import contextlib | 10 import contextlib |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
725 run_p.add_argument( | 725 run_p.add_argument( |
726 '--json', metavar='FILE', type=argparse.FileType('w'), | 726 '--json', metavar='FILE', type=argparse.FileType('w'), |
727 help='path to JSON output file') | 727 help='path to JSON output file') |
728 run_p.add_argument( | 728 run_p.add_argument( |
729 '--filter', action='append', | 729 '--filter', action='append', |
730 help='glob filter for the tests to run; ' | 730 help='glob filter for the tests to run; ' |
731 'can be specified multiple times; ' | 731 'can be specified multiple times; ' |
732 'the globs have the form of ' | 732 'the globs have the form of ' |
733 '`<recipe_name_glob>[.<test_name_glob>]`. If `.<test_name_glob>` ' | 733 '`<recipe_name_glob>[.<test_name_glob>]`. If `.<test_name_glob>` ' |
734 'is omitted, it is implied to be `.*`, i.e. all tests.)') | 734 'is omitted, it is implied to be `.*`, i.e. all tests.)') |
735 # TODO(phajdan.jr): remove --train the switch in favor of train subcommand. | |
735 run_p.add_argument( | 736 run_p.add_argument( |
736 '--train', action='store_true', | 737 '--train', action='store_true', |
737 help='re-generate recipe expectations') | 738 help='re-generate recipe expectations') |
iannucci
2017/03/31 17:50:09
let's add a deprecation text in the help too.
Paweł Hajdan Jr.
2017/03/31 17:51:44
Done.
| |
738 | 739 |
740 train_p = subp.add_parser('train', description='Re-train recipe expectations') | |
741 train_p.set_defaults(func=lambda opts: run_run( | |
742 opts.filter, jobs=opts.jobs, json_file=opts.json, train=True)) | |
743 train_p.add_argument( | |
744 '--jobs', metavar='N', type=int, | |
745 default=multiprocessing.cpu_count(), | |
746 help='run N jobs in parallel (default %(default)s)') | |
747 train_p.add_argument( | |
748 '--json', metavar='FILE', type=argparse.FileType('w'), | |
749 help='path to JSON output file') | |
750 train_p.add_argument( | |
751 '--filter', action='append', | |
752 help='glob filter for the tests to run; ' | |
753 'can be specified multiple times; ' | |
754 'the globs have the form of ' | |
755 '`<recipe_name_glob>[.<test_name_glob>]`. If `.<test_name_glob>` ' | |
756 'is omitted, it is implied to be `.*`, i.e. all tests.)') | |
757 | |
739 debug_p = subp.add_parser( | 758 debug_p = subp.add_parser( |
740 'debug', description='Run the tests under debugger (pdb)') | 759 'debug', description='Run the tests under debugger (pdb)') |
741 debug_p.set_defaults(func=lambda opts: run_run( | 760 debug_p.set_defaults(func=lambda opts: run_run( |
742 opts.filter, debug=True)) | 761 opts.filter, debug=True)) |
743 debug_p.add_argument( | 762 debug_p.add_argument( |
744 '--filter', action='append', | 763 '--filter', action='append', |
745 help='glob filter for the tests to run; ' | 764 help='glob filter for the tests to run; ' |
746 'can be specified multiple times; ' | 765 'can be specified multiple times; ' |
747 'the globs have the form of ' | 766 'the globs have the form of ' |
748 '`<recipe_name_glob>[.<test_name_glob>]`. If `.<test_name_glob>` ' | 767 '`<recipe_name_glob>[.<test_name_glob>]`. If `.<test_name_glob>` ' |
(...skipping 23 matching lines...) Expand all Loading... | |
772 Returns: | 791 Returns: |
773 Exit code | 792 Exit code |
774 """ | 793 """ |
775 global _UNIVERSE_VIEW | 794 global _UNIVERSE_VIEW |
776 _UNIVERSE_VIEW = universe_view | 795 _UNIVERSE_VIEW = universe_view |
777 global _ENGINE_FLAGS | 796 global _ENGINE_FLAGS |
778 _ENGINE_FLAGS = engine_flags | 797 _ENGINE_FLAGS = engine_flags |
779 | 798 |
780 args = parse_args(raw_args) | 799 args = parse_args(raw_args) |
781 return args.func(args) | 800 return args.func(args) |
OLD | NEW |