Esempio n. 1
0
def run(opts, context):
    # Load up build type plugin class
    build_type = get_build_type(opts.path)
    build_type_impl = get_class_for_build_type(build_type)()

    pkg_name = context.package_manifest.name

    # Run the uninstall command
    print("+++ Uninstalling '{0}'".format(pkg_name))
    on_uninstall_ret = build_type_impl.on_uninstall(context)
    handle_build_action(on_uninstall_ret, context)
Esempio n. 2
0
def run(opts, context):
    # Load up build type plugin class
    build_type = get_build_type(opts.path)
    build_type_impl = get_class_for_build_type(build_type)()

    pkg_name = context.package_manifest.name

    # Run the uninstall command
    print("+++ Uninstalling '{0}'".format(pkg_name))
    on_uninstall_ret = build_type_impl.on_uninstall(context)
    handle_build_action(on_uninstall_ret, context)
Esempio n. 3
0
def main(opts):
    opts.build_tests = True
    context = build_pkg_get_context(opts)
    context.retest_until_pass = (opts.retest_until_pass > 0)
    rc = build_pkg_run(opts, context)
    if rc:
        return rc

    # Load up build type plugin class
    build_type = get_build_type(opts.path)
    build_type_impl = get_class_for_build_type(build_type)()

    # Run the test command
    pkg_name = context.package_manifest.name
    print("+++ Testing '{0}'".format(pkg_name))
    context.test_iteration = 0
    while True:
        try:
            on_test_ret = build_type_impl.on_test(context)
        except (AttributeError, NotImplementedError):
            print("on_test() is not implemented for build type '%s'" %
                  build_type,
                  file=sys.stderr)
            return
        try:
            handle_build_action(on_test_ret, context)
        except SystemExit as e:
            # check if tests should be rerun
            if opts.retest_until_pass > context.test_iteration:
                context.test_iteration += 1
                print(
                    "+++ Testing '%s' again (retry #%d of %d)" %
                    (pkg_name, context.test_iteration, opts.retest_until_pass))
                continue
            # Automated systems can use --ignore-return-codes to allow them to react to
            # a failure to *run* a test but not a failure generated by a test that ran as
            # intended. Otherwise, we'll combine the two cases to help users to notice
            # when anything went wrong during a test run.
            if opts.ignore_return_codes:
                return
            else:
                return e.code
        # check if tests should be rerun
        if opts.retest_until_fail > context.test_iteration:
            context.test_iteration += 1
            print("+++ Testing '%s' again (retry #%d of %d)" %
                  (pkg_name, context.test_iteration, opts.retest_until_fail))
            continue
        break
Esempio n. 4
0
def main(opts):
    opts.build_tests = True
    context = build_pkg_get_context(opts)
    context.retest_until_pass = (opts.retest_until_pass > 0)
    rc = build_pkg_run(opts, context)
    if rc:
        return rc

    # Load up build type plugin class
    build_type = get_build_type(opts.path)
    build_type_impl = get_class_for_build_type(build_type)()

    # Run the test command
    pkg_name = context.package_manifest.name
    print("+++ Testing '{0}'".format(pkg_name))
    context.test_iteration = 0
    while True:
        try:
            on_test_ret = build_type_impl.on_test(context)
        except (AttributeError, NotImplementedError):
            print("on_test() is not implemented for build type '%s'" %
                  build_type, file=sys.stderr)
            return
        try:
            handle_build_action(on_test_ret, context)
        except SystemExit as e:
            # check if tests should be rerun
            if opts.retest_until_pass > context.test_iteration:
                context.test_iteration += 1
                print("+++ Testing '%s' again (retry #%d of %d)" %
                      (pkg_name, context.test_iteration, opts.retest_until_pass))
                continue
            # Automated systems can use --ignore-return-codes to allow them to react to
            # a failure to *run* a test but not a failure generated by a test that ran as
            # intended. Otherwise, we'll combine the two cases to help users to notice
            # when anything went wrong during a test run.
            if opts.ignore_return_codes:
                return
            else:
                return e.code
        # check if tests should be rerun
        if opts.retest_until_fail > context.test_iteration:
            context.test_iteration += 1
            print("+++ Testing '%s' again (retry #%d of %d)" %
                  (pkg_name, context.test_iteration, opts.retest_until_fail))
            continue
        break
Esempio n. 5
0
def main(opts):
    opts.build_tests = True
    context = build_pkg_get_context(opts)
    context.retest_until_pass = (opts.retest_until_pass > 0)
    rc = build_pkg_run(opts, context)
    if rc:
        return rc

    # Load up build type plugin class
    build_type = get_build_type(opts.path)
    build_type_impl = get_class_for_build_type(build_type)()

    # Run the test command
    pkg_name = context.package_manifest.name
    print("+++ Testing '{0}'".format(pkg_name))
    context.test_iteration = 0
    while True:
        try:
            on_test_ret = build_type_impl.on_test(context)
        except (AttributeError, NotImplementedError):
            print("on_test() is not implemented for build type '%s'" %
                  build_type,
                  file=sys.stderr)
            return
        try:
            handle_build_action(on_test_ret, context)
        except SystemExit:
            # check if tests should be rerun
            if opts.retest_until_pass > context.test_iteration:
                context.test_iteration += 1
                print(
                    "+++ Testing '%s' again (retry #%d of %d)" %
                    (pkg_name, context.test_iteration, opts.retest_until_pass))
                continue
            # there is no way to distinguish why the test returned non zero
            # the test invocation itself could have failed:
            # return e.code
            # but it could have also run successful and only failed some tests:
            return
        # check if tests should be rerun
        if opts.retest_until_fail > context.test_iteration:
            context.test_iteration += 1
            print("+++ Testing '%s' again (retry #%d of %d)" %
                  (pkg_name, context.test_iteration, opts.retest_until_fail))
            continue
        break
Esempio n. 6
0
def main(opts):
    opts.build_tests = True
    context = build_pkg_get_context(opts)
    rc = build_pkg_run(opts, context)
    if rc:
        return rc

    # Load up build type plugin class
    build_type = get_build_type(opts.path)
    build_type_impl = get_class_for_build_type(build_type)()

    # Run the test command
    pkg_name = context.package_manifest.name
    print("+++ Testing '{0}'".format(pkg_name))
    try:
        on_test_ret = build_type_impl.on_test(context)
    except (AttributeError, NotImplementedError):
        print("on_test() is not implemented for build type '%s'" % build_type,
              file=sys.stderr)
        return
    try:
        handle_build_action(on_test_ret, context)
    except SystemExit:
        return 1