tmpdir = local('/tmp/pytest-of-jenkins/pytest-0/test_opam_revision0')
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7f27367a3b70>
swh_storage = <swh.storage.proxies.retry.RetryingProxyStorage object at 0x7f27367a3128>
datadir = '/var/lib/jenkins/workspace/DLDBASE/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/loader/package/opam/tests/data'
def test_opam_revision(tmpdir, requests_mock_datadir, swh_storage, datadir):
opam_url = f"file://{datadir}/fake_opam_repo"
opam_root = tmpdir
# the directory should NOT exist, we just need an unique name, so we delete it
rmtree(tmpdir)
opam_instance = "loadertest"
opam_package = "ocb"
url = f"opam+{opam_url}/packages/{opam_package}"
loader = OpamLoader(
swh_storage, url, opam_root, opam_instance, opam_url, opam_package
)
# Run the loader, with a swh-storage instance, on the given URL.
# HTTP calls will be mocked by the requests_mock_datadir fixture
actual_load_status = loader.load()
expected_snapshot_id = hash_to_bytes("398df115b9feb2f463efd21941d69b7d59cd9025")
assert actual_load_status == {
"status": "eventful",
"snapshot_id": expected_snapshot_id.hex(),
}
info_iter = loader.get_package_info("0.1")
branch_name, package_info = next(info_iter)
expected_branch_name = "ocb.0.1"
print(package_info)
expected_package_info = OpamPackageInfo(
url="https://github.com/OCamlPro/ocb/archive/0.1.tar.gz",
filename=None,
directory_extrinsic_metadata=[],
author=Person(
fullname=b"OCamlPro <contact@ocamlpro.com>", name=None, email=None
),
committer=Person(
fullname=b"OCamlPro <contact@ocamlpro.com>", name=None, email=None
),
version="0.1",
)
assert branch_name == expected_branch_name
assert package_info == expected_package_info
snapshot_id = b"o\xad\x7f=\x07\xbb\xaah\xdbI(\xb0'\x10z\xfc\xff\x06x\x1b"
print(repr(snapshot_id))
snapshot = snapshot_get_all_branches(swh_storage, snapshot_id)
> assert snapshot is not None
E assert None is not None
.tox/py3/lib/python3.7/site-packages/swh/loader/package/opam/tests/test_opam.py:520: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 13 2021, 4:22 PM