Use CoreSWHID instead of the deprecated SWHID class
Test Plan
Tests won't pass on Jenkins until swh-model > 1.0.0 is released.
Locally, tests pass only if swh-web-client is patched line this:
@@ -558,7 +566,7 @@ def content_raw(self, swhid: SWHIDish, **req_args) -> Iterator[bytes]:
)
r.raise_for_status()
- yield from r.iter_content(chunk_size=None, decode_unicode=False)
+ yield r.content
def origin_search(
self,
Otherwise, r.iter_content
blocks on the second iteration. I don't understand why.
EDIT: updating requests and requests-mock fixes the issue, somehow...
Migrated from D5195 (view on Phabricator)
Merge request reports
Activity
Build has FAILED
Patch application report for D5195 (id=18590)
Rebasing onto 57d375a3...
Current branch diff-target is up to date.
Changes applied before test
commit 616d94512c259a95ef960d536f54c08e0d6281b9 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 14:30:01 2021 +0100 make all tests pass, assuming swh-web-client is patched line this: ``` @@ -558,7 +566,7 @@ def content_raw(self, swhid: SWHIDish, **req_args) -> Iterator[bytes]: ) r.raise_for_status() - yield from r.iter_content(chunk_size=None, decode_unicode=False) + yield r.content def origin_search( self, ``` commit db10ebd0354b272e2183eeacbb98e47235d445d5 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 13:01:35 2021 +0100 some fixes commit 13f4c3db5ba6941033ca8a94aecdaec179a2357d Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Mar 3 16:13:54 2021 +0100 [wip] Use CoreSWHID instead of the deprecated SWHID class
Link to build: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/268/ See console output for more information: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/268/console
Build has FAILED
Patch application report for D5195 (id=18591)
Rebasing onto 57d375a3...
Current branch diff-target is up to date.
Changes applied before test
commit c71b172b896444bc42f13d2134b860160b469043 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 14:37:14 2021 +0100 remove prints commit 616d94512c259a95ef960d536f54c08e0d6281b9 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 14:30:01 2021 +0100 make all tests pass, assuming swh-web-client is patched line this: ``` @@ -558,7 +566,7 @@ def content_raw(self, swhid: SWHIDish, **req_args) -> Iterator[bytes]: ) r.raise_for_status() - yield from r.iter_content(chunk_size=None, decode_unicode=False) + yield r.content def origin_search( self, ``` commit db10ebd0354b272e2183eeacbb98e47235d445d5 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 13:01:35 2021 +0100 some fixes commit 13f4c3db5ba6941033ca8a94aecdaec179a2357d Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Mar 3 16:13:54 2021 +0100 [wip] Use CoreSWHID instead of the deprecated SWHID class
Link to build: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/269/ See console output for more information: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/269/console
Build has FAILED
Patch application report for D5195 (id=18593)
Rebasing onto 57d375a3...
Current branch diff-target is up to date.
Changes applied before test
commit bdd4ad3a6fff49e0fc9c325477b3e7e6c00be8ce Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 14:37:14 2021 +0100 remove prints commit 616d94512c259a95ef960d536f54c08e0d6281b9 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 14:30:01 2021 +0100 make all tests pass, assuming swh-web-client is patched line this: ``` @@ -558,7 +566,7 @@ def content_raw(self, swhid: SWHIDish, **req_args) -> Iterator[bytes]: ) r.raise_for_status() - yield from r.iter_content(chunk_size=None, decode_unicode=False) + yield r.content def origin_search( self, ``` commit db10ebd0354b272e2183eeacbb98e47235d445d5 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 13:01:35 2021 +0100 some fixes commit 13f4c3db5ba6941033ca8a94aecdaec179a2357d Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Mar 3 16:13:54 2021 +0100 [wip] Use CoreSWHID instead of the deprecated SWHID class
Link to build: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/270/ See console output for more information: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/270/console
Build has FAILED
Patch application report for D5195 (id=18593)
Rebasing onto 57d375a3...
Current branch diff-target is up to date.
Changes applied before test
commit bdd4ad3a6fff49e0fc9c325477b3e7e6c00be8ce Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 14:37:14 2021 +0100 remove prints commit 616d94512c259a95ef960d536f54c08e0d6281b9 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 14:30:01 2021 +0100 make all tests pass, assuming swh-web-client is patched line this: ``` @@ -558,7 +566,7 @@ def content_raw(self, swhid: SWHIDish, **req_args) -> Iterator[bytes]: ) r.raise_for_status() - yield from r.iter_content(chunk_size=None, decode_unicode=False) + yield r.content def origin_search( self, ``` commit db10ebd0354b272e2183eeacbb98e47235d445d5 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 4 13:01:35 2021 +0100 some fixes commit 13f4c3db5ba6941033ca8a94aecdaec179a2357d Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Mar 3 16:13:54 2021 +0100 [wip] Use CoreSWHID instead of the deprecated SWHID class
Link to build: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/271/ See console output for more information: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/271/console
14 15 15 16 (fuse_mntdir / "archive" / REGULAR_FILE).is_file() 16 17 17 swhid = parse_swhid(REGULAR_FILE) 18 assert os.listdir(fuse_mntdir / "cache") == [swhid.object_id[:2], "origin"] 18 swhid = CoreSWHID.from_string(REGULAR_FILE) Could be my fault. I had used hex() in my branch, and @vlorentz might have gotten it from there. I agree using hash_to_hex would more consistent with the rest of the code.
mentioned in merge request !58 (closed)
LGTM too. I've also tried it locally, and it worked just fine, both interactively and when running the test suite.
I've only notice this (unrelated) warning:
WARNING:swh.core.cli:Could not load subcommand dataset: cannot import name 'swhid' from 'swh.model.identifiers' (/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-model/swh/model/identifiers.py)
Build has FAILED
Patch application report for D5195 (id=18609)
Rebasing onto 57d375a3...
Current branch diff-target is up to date.
Changes applied before test
commit f16f3a94748c286c4fc1228096befb3fab41bec9 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Mar 3 16:13:54 2021 +0100 Use CoreSWHID instead of the deprecated SWHID class
Link to build: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/272/ See console output for more information: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/272/console
Build has FAILED
Link to build: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/273/ See console output for more information: https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/273/console
Build is green
Patch application report for D5195 (id=18609)
Rebasing onto 57d375a3...
Current branch diff-target is up to date.
Changes applied before test
commit f16f3a94748c286c4fc1228096befb3fab41bec9 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Mar 3 16:13:54 2021 +0100 Use CoreSWHID instead of the deprecated SWHID class
See https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/274/ for more details.