Esempio n. 1
0
def run_set(path, target, test_method=None, apply_fix=False, log=None):
    """ Return tests results for font file, target """
    import os
    assert os.path.exists(path), '%s does not exists' % path
    tests_suite = make_suite(path,
                             target,
                             test_method=test_method,
                             apply_fix=apply_fix,
                             log=log)
    return run_suite(tests_suite)
    parser.add_argument("--list-checks", "-l", action="store_true", help="Print available checks", default=False)

    args = parser.parse_args()

    if args.list_checks:
        from bakery_lint.base import tests_report

        print(tests_report("upstream-repo"))
        sys.exit()

    for x in args.file:

        suite = get_suite(x)

        result = run_suite(suite)
        failures = [(testklass._testMethodName, testklass._err_msg) for testklass in result.get("failure", [])]
        error = [(testklass._testMethodName, testklass._err_msg) for testklass in result.get("error", [])]
        success = [(testklass._testMethodName, "OK") for testklass in result.get("success", [])]

        if not bool(failures + error):
            if args.verbose:
                for testmethod, dummyvar in success:
                    print("OK: {}".format(testmethod))
        else:
            for testmethod, errormessage in error:
                print("ER: {}: {}".format(testmethod, errormessage))
            if args.verbose:
                for testmethod, dummyvar in success:
                    print("OK: {}".format(testmethod))
            for testmethod, errormessage in failures:
Esempio n. 3
0
    args = parser.parse_args()

    if args.list_checks:
        from bakery_lint.base import tests_report
        print(tests_report('metadata'))
        sys.exit()

    for x in args.file:

        if not x.lower().endswith('metadata.json'):
            print('ER: {} is not METADATA.json'.format(x), file=sys.stderr)
            continue

        suite = get_suite(x, apply_autofix=args.autofix)

        result = run_suite(suite)
        failures = [(testklass._testMethodName, testklass._err_msg)
                    for testklass in result.get('failure', [])]
        error = [(testklass._testMethodName, testklass._err_msg)
                 for testklass in result.get('error', [])]
        success = [(testklass._testMethodName, 'OK')
                   for testklass in result.get('success', [])]

        if not bool(failures + error):
            if args.verbose:
                for testmethod, dummyvar in success:
                    print('OK: {}'.format(testmethod))
        else:
            for testmethod, errormessage in error:
                print('ER: {}: {}'.format(testmethod, errormessage))
            if args.verbose:
Esempio n. 4
0
def run_set(path, target, test_method=None, log=None):
    """ Return tests results for font file, target """
    import os
    assert os.path.exists(path), '%s does not exists' % path
    tests_suite = make_suite(path, target, test_method=test_method, log=log)
    return run_suite(tests_suite)