@@ -0,0 +1,2130 @@
+%22%22%22Script for performing common tasks for the tt project.%22%22%22%0A%0Afrom __future__ import print_function%0A%0Aimport os%0Aimport sys%0Aimport unittest%0A%0Afrom argparse import ArgumentParser, RawTextHelpFormatter%0A%0A%0AHERE = os.path.dirname(os.path.abspath(__file__))%0ATT_DIR = os.path.join(HERE, 'tt')%0ATESTS_DIR = os.path.join(TT_DIR, 'tests')%0A%0A%0Aclass TestFailureError(Exception):%0A    %22%22%22An exception type for failed tests.%22%22%22%0A%0A%0Adef test():%0A    %22%22%22Run tt tests.%22%22%22%0A    suite = unittest.defaultTestLoader.discover(%0A        TESTS_DIR,%0A        pattern='test_*.py',%0A        top_level_dir=HERE)%0A%0A    runner = unittest.TextTestRunner()%0A    result = runner.run(suite)%0A    if not result.wasSuccessful():%0A        raise TestFailureError%0A%0A%0ATASKS = %7B%0A    'test': test,%0A%7D%0A%0A%0Adef get_parsed_args(args=None):%0A    %22%22%22Get the parsed command line arguments.%0A%0A    Args:%0A        args (List%5Bstr%5D, optional): The list of command line args to parse;%0A            if left as None, sys.argv will be used.%0A%0A    Returns:%0A        argparse.Namespace: The Namespace object returned by the%0A            %60%60ArgumentParser.parse_args%60%60 function.%0A%0A    %22%22%22%0A    parser = ArgumentParser(%0A        prog='ttasks.py',%0A        description='Helper script for running tt project tasks (ttasks)',%0A        formatter_class=RawTextHelpFormatter)%0A%0A    parser.add_argument(%0A        'task',%0A        action='store',%0A        metavar='TASK',%0A        type=str,%0A        choices=sorted(TASKS.keys()),%0A        help='the ttask to run')%0A%0A    if args is None:%0A        args = sys.argv%5B1:%5D%0A%0A    return parser.parse_args(args)%0A%0A%0Adef main(args=None):%0A    %22%22%22Main routine for running this script.%0A%0A    Args:%0A        args (List%5Bstr%5D, optional): The %60%60args%60%60 argument to be passed to the%0A            %60%60get_parsed_args%60%60 function.%0A%0A    Returns:%0A        int: The exit code of the program.%0A%0A    %22%22%22%0A    try:%0A        opts = get_parsed_args()%0A        task = TASKS%5Bopts.task%5D%0A        task()%0A        return 0%0A    except TestFailureError:%0A        return 1%0A    except Exception as e:%0A        print('Received unexpected exception; re-raising it.', file=sys.stderr)%0A        raise e%0A%0A%0Aif __name__ == '__main__':%0A    sys.exit(main())%0A

Add project management script