swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_loader_one_visit0/loader.yml'
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7fcea2794198>
raw_sources = b'{\n "sources": [\n {\n "type": "url",\n "urls": [ "https://github.com/owner-1/repository-1/revision-1....Mcx6QctleltspAgXlM="\n }\n ],\n "version": "1",\n "revision": "cc4e04c26672dd74e5fd0fecb78b435fb55368f7"\n}\n'
def test_loader_one_visit(swh_config, requests_mock_datadir, raw_sources):
loader = NixGuixLoader(sources_url)
res = loader.load()
assert res["status"] == "eventful"
stats = get_stats(loader.storage)
assert {
"content": 1,
"directory": 3,
"origin": 1,
"origin_visit": 1,
"person": 1,
"release": 0,
"revision": 1,
"skipped_content": 0,
"snapshot": 1,
} == stats
# The visit is partial because urls pointing to non tarball file
# are not handled yet
assert_last_visit_matches(
loader.storage, sources_url, status="partial", type="nixguix"
)
(_, visit_status) = origin_get_latest_visit_status(loader.storage, sources_url)
snapshot_swhid = SWHID(
object_type="snapshot", object_id=hash_to_hex(visit_status.snapshot)
)
metadata_authority = MetadataAuthority(
type=MetadataAuthorityType.FORGE, url=sources_url,
)
expected_metadata = [
RawExtrinsicMetadata(
type=MetadataTargetType.SNAPSHOT,
id=snapshot_swhid,
authority=metadata_authority,
fetcher=MetadataFetcher(
name="swh.loader.package.nixguix.loader.NixGuixLoader",
version=__version__,
),
discovery_date=loader.visit_date,
format="nixguix-sources-json",
metadata=raw_sources,
origin=sources_url,
)
]
> assert loader.storage.raw_extrinsic_metadata_get(
type=MetadataTargetType.SNAPSHOT,
id=snapshot_swhid,
authority=metadata_authority,
) == PagedResult(next_page_token=None, results=expected_metadata,)
.tox/py3/lib/python3.7/site-packages/swh/loader/package/nixguix/tests/test_nixguix.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.storage.Storage object at 0x7fcea269bb70>, args = ()
kwargs = {'authority': MetadataAuthority(type=<MetadataAuthorityType.FORGE: 'forge'>, url='https://nix-community.github.io/nixp...881c74283793ebe9a09a105a9381e41380383', metadata=ImmutableDict({})), 'type': <MetadataTargetType.SNAPSHOT: 'snapshot'>}
cur = <cursor object at 0x7fcea915f900; closed: -1>
db = <swh.storage.db.Db object at 0x7fcea27a59e8>
@remove_kwargs(["cur", "db"])
@functools.wraps(meth)
def _meth(self, *args, **kwargs):
if "cur" in kwargs and kwargs["cur"]:
cur = kwargs["cur"]
old_options = apply_options(cur, __client_options)
ret = meth(self, *args, **kwargs)
apply_options(cur, old_options)
return ret
else:
db = self.get_db()
try:
with db.transaction() as cur:
apply_options(cur, __client_options)
> return meth(self, *args, db=db, cur=cur, **kwargs)
E TypeError: raw_extrinsic_metadata_get() got an unexpected keyword argument 'type'
.tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:62: TypeError
TEST RESULT
TEST RESULT
- Run At
- Jul 31 2020, 1:22 PM