Exemplo n.º 1
0
def test_modulemd_merge_two_yamls_first_missing(capsys):

    inputs = (os.path.join(test_data_dir, "missing-file.yaml"),
              os.path.join(test_data_dir, "moduleB.yaml"))
    with patch("argparse.ArgumentParser.parse_args",
               return_value=_testrun_args(inputs)):
        with pytest.raises(ValueError) as excinfo:
            modulemd_merge.main()

    assert f"input file {test_data_dir}/missing-file.yaml does not exist" in str(
        excinfo.value)
Exemplo n.º 2
0
def test_modulemd_merge_module_with_repomd_file(capsys,
                                                module_with_repodata_dir):

    inputs = (os.path.join(test_data_dir, "moduleA.yaml"), test_repomd_file)
    with patch("argparse.ArgumentParser.parse_args",
               return_value=_testrun_args(inputs)):
        modulemd_merge.main()

    captured = capsys.readouterr()
    assert [d
            for d in yaml.load_all(captured.out, Loader=yaml.SafeLoader)] == [
                d for d in yaml.load_all(module_with_repodata_dir,
                                         Loader=yaml.SafeLoader)
            ]
Exemplo n.º 3
0
def test_modulemd_merge_two_yamls_first_missing_ignore_no_input(
        capsys, moduleB_yaml):

    inputs = (os.path.join(test_data_dir, "missing-file.yaml"),
              os.path.join(test_data_dir, "moduleB.yaml"))
    kwargs = {"ignore_no_input": True}
    with patch("argparse.ArgumentParser.parse_args",
               return_value=_testrun_args(inputs, **kwargs)):
        modulemd_merge.main()

    captured = capsys.readouterr()
    assert [
        d for d in yaml.load_all(captured.out, Loader=yaml.SafeLoader)
    ] == [d for d in yaml.load_all(moduleB_yaml, Loader=yaml.SafeLoader)]
Exemplo n.º 4
0
def test_modulemd_merge_two_yamls(capsys, two_modules_merged_yamls):

    inputs = (os.path.join(test_data_dir, "moduleA.yaml"),
              os.path.join(test_data_dir, "moduleB.yaml"))
    with patch("argparse.ArgumentParser.parse_args",
               return_value=_testrun_args(inputs)):
        modulemd_merge.main()

    captured = capsys.readouterr()
    assert [d
            for d in yaml.load_all(captured.out, Loader=yaml.SafeLoader)] == [
                d for d in yaml.load_all(two_modules_merged_yamls,
                                         Loader=yaml.SafeLoader)
            ]