Page MenuHomeSoftware Heritage

D3436.id12167.diff
No OneTemporary

D3436.id12167.diff

diff --git a/swh/loader/package/nixguix/loader.py b/swh/loader/package/nixguix/loader.py
--- a/swh/loader/package/nixguix/loader.py
+++ b/swh/loader/package/nixguix/loader.py
@@ -196,7 +196,8 @@
)
# Only the version 1 is currently supported
- if sources["version"] != 1:
+ version = int(sources["version"])
+ if version != 1:
raise ValueError(
"The sources structure version '%d' is not supported", sources["version"]
)
diff --git a/swh/loader/package/nixguix/tests/data/https_nix-community.github.io/nixpkgs-swh_sources.json b/swh/loader/package/nixguix/tests/data/https_nix-community.github.io/nixpkgs-swh_sources.json
--- a/swh/loader/package/nixguix/tests/data/https_nix-community.github.io/nixpkgs-swh_sources.json
+++ b/swh/loader/package/nixguix/tests/data/https_nix-community.github.io/nixpkgs-swh_sources.json
@@ -11,6 +11,6 @@
"integrity": "sha256-Q0copBCnj1b8G1iZw1k0NuYasMcx6QctleltspAgXlM="
}
],
- "version": 1,
+ "version": "1",
"revision": "cc4e04c26672dd74e5fd0fecb78b435fb55368f7"
}
diff --git a/swh/loader/package/nixguix/tests/test_nixguix.py b/swh/loader/package/nixguix/tests/test_nixguix.py
--- a/swh/loader/package/nixguix/tests/test_nixguix.py
+++ b/swh/loader/package/nixguix/tests/test_nixguix.py
@@ -59,12 +59,16 @@
def test_clean_sources_invalid_version(swh_config, requests_mock_datadir):
- sources = {"version": 2, "sources": [], "revision": "my-revision"}
-
- with pytest.raises(
- ValueError, match="sources structure version .* is not supported"
- ):
- clean_sources(sources)
+ for version_ok in [1, "1"]: # Check those versions are fine
+ clean_sources({"version": version_ok, "sources": [], "revision": "my-revision"})
+
+ # but not version > 1
+ for version_ko in [2, "2"]: # Check those versions are fine
+ with pytest.raises(
+ ValueError, match="sources structure version .* is not supported"
+ ):
+ clean_sources({"version": 2, "sources": [], "revision": "my-revision"})
+ clean_sources({"version": 2, "sources": [], "revision": "my-revision"})
def test_clean_sources_invalid_sources(swh_config, requests_mock_datadir):

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 9:39 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3227033

Event Timeline