diff --git a/requirements-swh.txt b/requirements-swh.txt --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -2,5 +2,5 @@ swh.model >= 0.0.15 swh.objstorage >= 0.0.28 swh.scheduler >= 0.0.47 -swh.storage >= 0.0.143 +swh.storage >= 0.0.155, < 0.0.156 swh.journal >= 0.0.17 diff --git a/swh/indexer/tests/test_metadata.py b/swh/indexer/tests/test_metadata.py --- a/swh/indexer/tests/test_metadata.py +++ b/swh/indexer/tests/test_metadata.py @@ -6,6 +6,8 @@ import json import unittest +import attr + from hypothesis import given, strategies, settings, HealthCheck from swh.model.hashutil import hash_to_bytes @@ -1165,7 +1167,7 @@ rev_id = hash_to_bytes('8dbb6aeb036e7fd80664eb8bfd1507881af1ba9f') rev = metadata_indexer.storage._revisions[rev_id] subdir_id = rev.directory - rev.directory = b'123456' + rev = attr.evolve(rev, directory=b'123456') metadata_indexer.storage.directory_add([{ 'id': b'123456', 'entries': [{ diff --git a/swh/indexer/tests/test_origin_head.py b/swh/indexer/tests/test_origin_head.py --- a/swh/indexer/tests/test_origin_head.py +++ b/swh/indexer/tests/test_origin_head.py @@ -53,11 +53,11 @@ """Checks partial snapshots are ignored.""" origin_url = 'https://github.com/SoftwareHeritage/swh-core' self.indexer.storage.origin_add_one({ - 'type': 'git', 'url': origin_url, }) visit = self.indexer.storage.origin_visit_add( - origin_url, '2019-02-27') + origin_url, '2019-02-27', type='git', + ) self.indexer.storage.snapshot_add([{ 'id': b'foo', 'branches': { @@ -85,11 +85,10 @@ def test_pypi_missing_branch(self): origin_url = 'https://pypi.org/project/abcdef/' self.indexer.storage.origin_add_one({ - 'type': 'pypi', 'url': origin_url, }) visit = self.indexer.storage.origin_visit_add( - origin_url, '2019-02-27') + origin_url, '2019-02-27', type='pypi') self.indexer.storage.snapshot_add([{ 'id': b'foo', 'branches': { diff --git a/swh/indexer/tests/utils.py b/swh/indexer/tests/utils.py --- a/swh/indexer/tests/utils.py +++ b/swh/indexer/tests/utils.py @@ -34,7 +34,7 @@ }, } -ORIGINS = [ +ORIGIN_VISITS = [ { 'type': 'git', 'url': 'https://github.com/SoftwareHeritage/swh-storage'}, @@ -541,11 +541,16 @@ def fill_storage(storage): - for origin in ORIGINS: - storage.origin_add_one(origin) + visit_types = {} + for origin in ORIGIN_VISITS: + storage.origin_add_one({'url': origin['url']}) + visit_types[origin['url']] = origin['type'] for snap in SNAPSHOTS: origin_url = snap['origin'] - visit = storage.origin_visit_add(origin_url, datetime.datetime.now()) + visit = storage.origin_visit_add( + origin=origin_url, + date=datetime.datetime.now(), + type=visit_types[origin_url]) snap_id = snap.get('id') or \ bytes([random.randint(0, 255) for _ in range(32)]) storage.snapshot_add([{