def test_raw_files_to_sync(packit_files, expected): with cwd(TESTS_DIR): pc = PackageConfig( dist_git_base_url="https://packit.dev/", downstream_package_name="packit", dist_git_namespace="awesome", specfile_path="fedora/package.spec", synced_files=packit_files, ) assert set(pc.synced_files.raw_files_to_sync) == set(expected)
def api_instance_source_git(sourcegit_n_distgit): sourcegit, distgit = sourcegit_n_distgit with cwd(sourcegit): c = get_test_config() pc = get_local_package_config(str(sourcegit)) pc.upstream_project_url = str(sourcegit) pc.downstream_project_url = str(distgit) up_lp = LocalProject(path_or_url=str(sourcegit)) api = PackitAPI(c, pc, up_lp) return api
def test_basic_build(upstream_n_distgit, mock_remote_functionality_upstream): u, d = upstream_n_distgit with cwd(u): c = get_test_config() pc = get_local_package_config(str(u)) pc.upstream_project_url = str(u) pc.downstream_project_url = str(d) up_lp = LocalProject(path_or_url=u) api = PackitAPI(c, pc, up_lp) api.build("master")
def upstream_instance(upstream_n_distgit, tmpdir): with cwd(tmpdir): u, d = upstream_n_distgit c = get_test_config() pc = get_local_package_config(str(u)) pc.upstream_project_url = str(u) pc.downstream_project_url = str(d) lp = LocalProject(path_or_url=str(u)) ups = Upstream(c, pc, lp) yield u, ups
def test_cartesian2internal(tmp_path, root, fname_coordinates, fname_forces, fname_zmatrix): with cwd(tmp_path): fname_coordinates = root / fname_coordinates fname_forces = root / fname_forces fname_zmatrix = root / fname_zmatrix out_file = run(fname_coordinates, fname_forces, fname_zmatrix) file1 = root / out_file.name file2 = Path(out_file) assert_comp_forces(file1, file2)
def test_basic_bodhi_update( upstream_n_distgit, mock_remote_functionality_upstream, branch, update_type, update_notes, koji_builds, bodhi_response, ): # https://github.com/fedora-infra/bodhi/issues/3058 from bodhi.client.bindings import BodhiClient u, d = upstream_n_distgit with cwd(u): c = get_test_config() pc = get_local_package_config(str(u)) pc.upstream_project_url = str(u) pc.downstream_project_url = str(d) up_lp = LocalProject(path_or_url=u) api = PackitAPI(c, pc, up_lp) flexmock( BodhiClient, latest_builds=lambda package: { "f29-override": "sen-0.6.0-3.fc29", "f29-updates": "sen-0.6.0-3.fc29", "f29-updates-candidate": "sen-0.6.0-3.fc29", "f29-updates-pending": "sen-0.6.0-3.fc29", "f29-updates-testing": "sen-0.6.0-3.fc29", "f29-updates-testing-pending": "sen-0.6.0-3.fc29", "f30-override": "sen-0.6.0-4.fc30", "f30-updates": "sen-0.6.0-4.fc30", "f30-updates-candidate": "sen-0.6.1-1.fc30", "f30-updates-pending": "sen-0.6.0-4.fc30", "f30-updates-testing": "sen-0.6.0-4.fc30", "f30-updates-testing-pending": "sen-0.6.0-4.fc30", }, save=lambda **kwargs: bodhi_response, ) api.create_update( dist_git_branch=branch, update_type=update_type, update_notes=update_notes, koji_builds=koji_builds, )
def test_basic_local_update_from_downstream( downstream_n_distgit, mock_downstream_remote_functionality): flexmock(LocalProject, _parse_namespace_from_git_url=lambda: None) u, d = downstream_n_distgit with cwd(u): c = get_test_config() pc = get_local_package_config(str(u)) pc.upstream_project_url = str(u) pc.downstream_project_url = str(d) up_lp = LocalProject(path_or_url=str(u)) api = PackitAPI(c, pc, up_lp) api.sync_from_downstream("master", "master", True) assert (u / "beer.spec").is_file() spec = get_specfile(str(u / "beer.spec")) assert spec.get_version() == "0.0.0"
def test_basic_local_update(upstream_n_distgit, mock_remote_functionality_upstream): """ basic propose-update test: mock remote API, use local upstream and dist-git """ u, d = upstream_n_distgit with cwd(u): c = get_test_config() pc = get_local_package_config(str(u)) pc.upstream_project_url = str(u) pc.downstream_project_url = str(d) up_lp = LocalProject(path_or_url=str(u)) api = PackitAPI(c, pc, up_lp) api.sync_release("master", "0.1.0") assert (d / TARBALL_NAME).is_file() spec = get_specfile(str(d / "beer.spec")) assert spec.get_version() == "0.1.0"