Exemple #1
0
def main(args=None):

    args = args or sys.argv[1:]

    args = parse_args(args)

    if not args.testrail_plan_name:
        args.testrail_plan_name = ('{0.testrail_milestone} iso '
                                   '#{0.iso_id}').format(args)

        msg = ("--iso-id parameter is DEPRECATED. "
               "It is recommended to use --testrail-plan-name parameter.")
        warnings.warn(msg, DeprecationWarning)

    logger_dict = dict(stream=sys.stderr)
    if args.verbose:
        logger_dict['level'] = logging.DEBUG

    logging.basicConfig(**logger_dict)

    reporter = Reporter(
        xunit_report=args.xunit_report,
        output_xunit_report=args.output_xunit_report,
        env_description=args.env_description,
        test_results_link=args.test_results_link,
        paste_url=args.paste_url)
    suite = args.testrail_suite.format(args)
    reporter.config_testrail(
        base_url=args.testrail_url,
        username=args.testrail_user,
        password=args.testrail_password,
        project=args.testrail_project,
        tests_suite=suite,
        send_skipped=args.send_skipped,
        send_duplicates=args.send_duplicates,
        use_test_run_if_exists=args.use_test_run_if_exists)


    all_cases = reporter.get_cases()
    empty_classnames = reporter.get_empty_classnames()
    all_empty_cases = reporter.get_testcases(all_cases, empty_classnames)

    reporter.update_testcases(all_empty_cases)
    reporter.delete_duplicates()
    reporter.delete_temporary_file()