Beispiel #1
0
def main(args):
    parser = create_parser()
    parsed_args = parser.parse_args(args)

    design_kw.run(
        template_file_name=parsed_args.templatefile,
        result_file_name=parsed_args.resultfile,
        log_level=parsed_args.log_level,
    )
Beispiel #2
0
def test_genkw_prefix_handling(paramlines, template, result, tmpdir):
    tmpdir.chdir()
    with open("parameters.txt", "w") as file_h:
        file_h.write(paramlines)
    with open("template.tmpl", "w") as file_h:
        file_h.write(template)
    design_kw.run("template.tmpl", "result.txt", logging.DEBUG)
    with open("result.txt", "r") as file_h:
        resulttxt = "\n".join(file_h.readlines())
    assert resulttxt == result
Beispiel #3
0
def test_run_unmatched(input_data):
    template_filename = "template_unmatched.yml.tmpl"
    result_filename = "template.yml"
    design_kw.run(
        template_file_name=template_filename,
        result_file_name=result_filename,
        log_level=logging.DEBUG,
        parameters_file_name="parameters.txt",
    )

    assert not os.path.isfile(design_kw._STATUS_FILE_NAME)
Beispiel #4
0
def test_run_duplicate_keys(input_data):
    template_filename = "template.yml.tmpl"
    result_filename = "template.yml"
    with pytest.raises(ValueError, match="multiple"):
        design_kw.run(
            template_file_name=template_filename,
            result_file_name=result_filename,
            log_level=logging.DEBUG,
            parameters_file_name="parameters_w_duplicates.txt",
        )

    assert not os.path.isfile(design_kw._STATUS_FILE_NAME)
Beispiel #5
0
def test_run(input_data, filenames):
    reference_filename = filenames[0]
    template_filename = filenames[1]
    result_filename = filenames[2]

    design_kw.run(template_filename, result_filename, log_level=logging.DEBUG)

    with open(result_filename, "r") as result_file:
        result = result_file.read()

    with open(reference_filename, "r") as reference_file:
        reference = reference_file.read()

    with open(design_kw._STATUS_FILE_NAME, "r") as status_file:
        status = status_file.read()

    assert result == reference
    assert status == "DESIGN_KW OK\n"