Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9340546
D6312.id22917.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D6312.id22917.diff
View Options
diff --git a/swh/lister/opam/lister.py b/swh/lister/opam/lister.py
--- a/swh/lister/opam/lister.py
+++ b/swh/lister/opam/lister.py
@@ -8,7 +8,7 @@
import os
from subprocess import PIPE, Popen, call
import tempfile
-from typing import Iterator
+from typing import Iterator, Optional
from swh.lister.pattern import StatelessLister
from swh.scheduler.interface import SchedulerInterface
@@ -44,7 +44,7 @@
self,
scheduler: SchedulerInterface,
url: str,
- instance: str,
+ instance: Optional[str] = None,
credentials: CredentialsType = None,
):
super().__init__(
diff --git a/swh/lister/opam/tests/test_lister.py b/swh/lister/opam/tests/test_lister.py
--- a/swh/lister/opam/tests/test_lister.py
+++ b/swh/lister/opam/tests/test_lister.py
@@ -28,12 +28,22 @@
return mock_init, mock_open
+def test_lister_opam_optional_instance(swh_scheduler):
+ """Instance name should be optional and default to be built out of the netloc."""
+ netloc = "opam.ocaml.org"
+ instance_url = f"https://{netloc}"
+
+ lister = OpamLister(swh_scheduler, url=instance_url)
+ assert lister.instance == netloc
+
+
def test_urls(swh_scheduler, mock_opam):
mock_init, mock_popen = mock_opam
instance_url = "https://opam.ocaml.org"
lister = OpamLister(swh_scheduler, url=instance_url, instance="opam")
+ assert lister.instance == "opam"
# call the lister and get all listed origins urls
stats = lister.run()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jul 3 2025, 10:49 AM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3227519
Attached To
D6312: opam: Make the instance optional and derived from the url
Event Timeline
Log In to Comment