Page MenuHomeSoftware Heritage

D427.id.diff
No OneTemporary

D427.id.diff

diff --git a/swh/loader/pypi/loader.py b/swh/loader/pypi/loader.py
--- a/swh/loader/pypi/loader.py
+++ b/swh/loader/pypi/loader.py
@@ -159,6 +159,7 @@
self._contents = []
self._directories = []
self._revisions = []
+ self._load_status = 'uneventful'
def fetch_data(self):
"""Called once per release artifact version (can be many for one
@@ -179,6 +180,7 @@
try:
data = next(self.new_artifacts)
+ self._load_status = 'eventful'
except StopIteration:
self.done = True
return False
@@ -272,6 +274,11 @@
self.generate_and_load_snapshot()
self.flush()
+ def load_status(self):
+ return {
+ 'status': self._load_status,
+ }
+
if __name__ == '__main__':
import logging
diff --git a/swh/loader/pypi/tests/test_loader.py b/swh/loader/pypi/tests/test_loader.py
--- a/swh/loader/pypi/tests/test_loader.py
+++ b/swh/loader/pypi/tests/test_loader.py
@@ -206,6 +206,8 @@
self.assertSnapshotOk('5c99339508de5eea67eecd3e0ba1efa8e804b96e',
expected_branches)
+ self.assertEqual(self.loader.load_status(), {'status': 'eventful'})
+
class PyPILoaderWithSnapshot(TestPyPILoader):
"""This loader provides a snapshot and lists corresponding seen
@@ -303,6 +305,8 @@
_id = hashutil.hash_to_hex(self.loader._last_snapshot()['id'])
self.assertEquals(expected_snapshot_id, _id)
+ self.assertEqual(self.loader.load_status(), {'status': 'uneventful'})
+
class LoaderNewChangesSinceLastVisitITest(BaseLoaderITest):
"""In this scenario, a visit has already taken place.
@@ -397,6 +401,8 @@
_id = hashutil.hash_to_hex(self.loader._last_snapshot()['id'])
self.assertNotEqual(expected_snapshot_id, _id)
+ self.assertEqual(self.loader.load_status(), {'status': 'eventful'})
+
class PyPILoaderWithSnapshot2(TestPyPILoader):
"""This loader provides a snapshot and lists corresponding seen
@@ -532,3 +538,5 @@
_id = hashutil.hash_to_hex(self.loader._last_snapshot()['id'])
self.assertNotEqual(expected_snapshot_id, _id)
+
+ self.assertEqual(self.loader.load_status(), {'status': 'eventful'})

File Metadata

Mime Type
text/plain
Expires
Nov 5 2024, 6:46 AM (8 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221908

Event Timeline