Ejemplo n.º 1
0
def test_srpm_command_for_path(upstream_or_distgit_path):
    call_real_packit(
        parameters=["--debug", "srpm",
                    str(upstream_or_distgit_path)])
    srpm_path = list(Path.cwd().glob("*.src.rpm"))[0]
    assert srpm_path.exists()
    build_srpm(srpm_path)
Ejemplo n.º 2
0
def test_srpm_custom_path(upstream_instance):
    u, ups = upstream_instance
    custom_path = "sooooorc.rpm"
    call_real_packit(parameters=["--debug", "srpm", "--output", custom_path],
                     cwd=u)
    srpm_path = u.joinpath(custom_path)
    assert srpm_path.is_file()
    build_srpm(srpm_path)
Ejemplo n.º 3
0
def test_srpm_on_example(example_repo):
    c = get_test_config()
    api = get_packit_api(
        config=c, local_project=LocalProject(working_dir=str(example_repo)))
    with cwd(example_repo):
        path = api.create_srpm()
    assert path.exists()
    build_srpm(path)
Ejemplo n.º 4
0
def test_srpm_snapd(snapd):
    pc = get_local_package_config(str(snapd))
    up_lp = LocalProject(working_dir=str(snapd))
    c = get_test_config()
    api = PackitAPI(c, pc, up_lp)
    with cwd(snapd):
        path = api.create_srpm()
    assert path.exists()
    build_srpm(path)
Ejemplo n.º 5
0
def test_srpm_custom_path(cwd_upstream_or_distgit):
    custom_path = "sooooorc.rpm"
    call_real_packit(
        parameters=["--debug", "srpm", "--output", custom_path],
        cwd=cwd_upstream_or_distgit,
    )
    srpm_path = cwd_upstream_or_distgit.joinpath(custom_path)
    assert srpm_path.is_file()
    build_srpm(srpm_path)
Ejemplo n.º 6
0
def test_srpm(mock_remote_functionality_sourcegit, api_instance_source_git):
    # TODO: we need a better test case here which will mimic the systemd use case
    sg_path = Path(api_instance_source_git.upstream_local_project.working_dir)
    mock_spec_download_remote_s(sg_path / "fedora")
    with cwd(sg_path):
        api_instance_source_git.create_srpm(upstream_ref="0.1.0")
    srpm_path = list(sg_path.glob("beer-0.1.0-2.*.src.rpm"))[0]
    assert srpm_path.is_file()
    build_srpm(srpm_path)
Ejemplo n.º 7
0
def test_srpm_twice(upstream_instance):
    u, ups = upstream_instance
    call_real_packit(parameters=["--debug", "srpm"], cwd=u)
    call_real_packit(parameters=["--debug", "srpm"], cwd=u)

    # since we build from the 0.1.0, we would get the same SRPM because of '--new 0.1.0'
    srpm_files = list(u.glob("*.src.rpm"))

    assert srpm_files[0].exists()

    build_srpm(srpm_files[0])
Ejemplo n.º 8
0
def test_srpm_twice(cwd_upstream_or_distgit):
    call_real_packit(parameters=["--debug", "srpm"],
                     cwd=cwd_upstream_or_distgit)
    call_real_packit(parameters=["--debug", "srpm"],
                     cwd=cwd_upstream_or_distgit)

    # since we build from the 0.1.0, we would get the same SRPM because of '--new 0.1.0'
    srpm_files = list(cwd_upstream_or_distgit.glob("*.src.rpm"))

    assert srpm_files[0].exists()

    build_srpm(srpm_files[0])
Ejemplo n.º 9
0
def test_srpm_twice_with_custom_name(upstream_instance):
    u, ups = upstream_instance
    custom_path = "sooooorc.rpm"
    call_real_packit(parameters=["--debug", "srpm", "--output", custom_path],
                     cwd=u)
    srpm_path1 = u.joinpath(custom_path)
    assert srpm_path1.is_file()
    build_srpm(srpm_path1)

    custom_path2 = "sooooorc2.rpm"
    call_real_packit(parameters=["--debug", "srpm", "--output", custom_path2],
                     cwd=u)
    srpm_path2 = u.joinpath(custom_path2)
    assert srpm_path2.is_file()
    build_srpm(srpm_path2)
Ejemplo n.º 10
0
def test_create_srpm(upstream_instance, tmpdir):
    u, ups = upstream_instance

    with pytest.raises(PackitException) as exc:
        ups.create_srpm()
    assert "Failed to create SRPM." == str(exc.value)

    ups.create_archive()
    srpm = ups.create_srpm()

    assert srpm.exists()

    srpm_path = Path(tmpdir).joinpath("custom.src.rpm")
    srpm = ups.create_srpm(srpm_path=srpm_path)
    assert srpm.exists()
    build_srpm(srpm)
Ejemplo n.º 11
0
def test_srpm_twice_with_custom_name(cwd_upstream_or_distgit):
    custom_path = "sooooorc.rpm"
    call_real_packit(
        parameters=["--debug", "srpm", "--output", custom_path],
        cwd=cwd_upstream_or_distgit,
    )
    srpm_path1 = cwd_upstream_or_distgit.joinpath(custom_path)
    assert srpm_path1.is_file()
    build_srpm(srpm_path1)

    custom_path2 = "sooooorc2.rpm"
    call_real_packit(
        parameters=["--debug", "srpm", "--output", custom_path2],
        cwd=cwd_upstream_or_distgit,
    )
    srpm_path2 = cwd_upstream_or_distgit.joinpath(custom_path2)
    assert srpm_path2.is_file()
    build_srpm(srpm_path2)
Ejemplo n.º 12
0
def test_srpm_command(upstream_instance):
    u, ups = upstream_instance
    call_real_packit(parameters=["--debug", "srpm"], cwd=u)
    srpm_path = list(u.glob("*.src.rpm"))[0]
    assert srpm_path.exists()
    build_srpm(srpm_path)
Ejemplo n.º 13
0
def test_srpm_command(cwd_upstream_or_distgit):
    call_real_packit(parameters=["--debug", "srpm"],
                     cwd=cwd_upstream_or_distgit)
    srpm_path = list(cwd_upstream_or_distgit.glob("*.src.rpm"))[0]
    assert srpm_path.exists()
    build_srpm(srpm_path)