Beispiel #1
0
    # scenario_base.sanitize_results_data(copied_dirpath)

    # Launch parser on copied_dirpath, collect emitted test objects.
    harness = scenario_base.new_parser_harness(copied_dirpath)
    try:
        parser_result = harness.execute()
    except Exception, e:
        parser_result = e

    scenario_base.store_parser_result(
        scenario_package_dirpath, parser_result,
        options.parser_result_tag)

    scenario_base.store_results_dir(
        scenario_package_dirpath, copied_dirpath)

    scenario_base.write_config(
        scenario_package_dirpath,
        status_version=harness.status_version,
        parser_result_tag=options.parser_result_tag,
    )

    scenario_base.install_unittest_module(
        scenario_package_dirpath, options.template_type)
    tmp_dirpath.clean()


if __name__ == '__main__':
    main()
    # Copy results_dir
    shutil.copytree(results_dirpath, copied_dirpath)

    # scenario_base.sanitize_results_data(copied_dirpath)

    # Launch parser on copied_dirpath, collect emitted test objects.
    harness = scenario_base.new_parser_harness(copied_dirpath)
    try:
        parser_result = harness.execute()
    except Exception, e:
        parser_result = e

    scenario_base.store_parser_result(scenario_package_dirpath, parser_result,
                                      options.parser_result_tag)

    scenario_base.store_results_dir(scenario_package_dirpath, copied_dirpath)

    scenario_base.write_config(
        scenario_package_dirpath,
        status_version=harness.status_version,
        parser_result_tag=options.parser_result_tag,
    )

    scenario_base.install_unittest_module(scenario_package_dirpath,
                                          options.template_type)
    tmp_dirpath.clean()


if __name__ == '__main__':
    main()
Beispiel #3
0
def main():
    (options, args) = parser.parse_args()
    if len(args) < 2:
        parser.print_help()
        sys.exit(1)

    results_dirpath = path.normpath(args[0])
    if not path.exists(results_dirpath) or not path.isdir(results_dirpath):
        print('Invalid results_dirpath:', results_dirpath)
        parser.print_help()
        sys.exit(1)

    scenarios_dirpath = path.normpath(args[1])
    if not path.exists(scenarios_dirpath) or not path.isdir(scenarios_dirpath):
        print('Invalid scenarios_dirpath:', scenarios_dirpath)
        parser.print_help()
        sys.exit(1)

    results_dirname = path.basename(results_dirpath)
    # Not everything is a valid python package name, fix if necessary
    package_dirname = scenario_base.fix_package_dirname(options.name
                                                        or results_dirname)

    scenario_package_dirpath = path.join(scenarios_dirpath, package_dirname)
    if path.exists(scenario_package_dirpath):
        print('Scenario package already exists at path: %s' %
              scenario_package_dirpath)
        parser.print_help()
        sys.exit(1)

    # Create new scenario package
    os.mkdir(scenario_package_dirpath)

    # Create tmp_dir
    tmp_dirpath = autotemp.tempdir(unique_id='new_scenario')
    copied_dirpath = path.join(tmp_dirpath.name, results_dirname)
    # Copy results_dir
    shutil.copytree(results_dirpath, copied_dirpath)

    # scenario_base.sanitize_results_data(copied_dirpath)

    # Launch parser on copied_dirpath, collect emitted test objects.
    harness = scenario_base.new_parser_harness(copied_dirpath)
    try:
        parser_result = harness.execute()
    except Exception as e:
        parser_result = e

    scenario_base.store_parser_result(scenario_package_dirpath, parser_result,
                                      options.parser_result_tag)

    scenario_base.store_results_dir(scenario_package_dirpath, copied_dirpath)

    scenario_base.write_config(
        scenario_package_dirpath,
        status_version=harness.status_version,
        parser_result_tag=options.parser_result_tag,
    )

    scenario_base.install_unittest_module(scenario_package_dirpath,
                                          options.template_type)
    tmp_dirpath.clean()