Page MenuHomeSoftware Heritage

loader.cli: Reference new cli
ClosedPublic

Authored by ardumont on Dec 4 2019, 7:45 PM.

Details

Summary

This installs a swh loader subcommand.
This allows loading of url for a given loader.

This also aligns the npm loader's constructor to be consistent with other
loaders (having only one url as constructor parameter).

Related to T2134

Diff Detail

Repository
rDLDBASE Generic VCS/Package Loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont retitled this revision from loader.cli: Reference new loader cli to loader.cli: Reference new cli.Dec 5 2019, 9:37 AM
  • loader.cli: Add tests around cli

(that still cannot pass green here though, need to land the loaders' first D2395)

  • loader.cli: Reference new loader cli
  • package.npm: Align loader instantiation
  • loader.cli: Add tests around cli
  • requirements-test: Add missing test dependency
anlambert added a subscriber: anlambert.

Looks good to me !

swh/loader/cli.py
61

Load an origin from its url with loader <name>

swh/loader/package/npm/loader.py
49 ↗(On Diff #8456)

nitpick: it's better to use concrete type (here Dict) when typing return value

swh/loader/tests/test_cli.py
82 ↗(On Diff #8456)

Triggering

85 ↗(On Diff #8456)

this should be removed I think

93 ↗(On Diff #8456)

same here

This revision is now accepted and ready to land.Dec 6 2019, 1:21 PM

Adapt according to review

Adapt according to review (i missed one)

  • Fix test on cli (forgot to amend the test after changing the cli's help message)
  • Use pytest-mock's mocker fixture in tests needing to patch behavior
requirements-test.txt
2 ↗(On Diff #8477)

It's packaged in debian stable so ok: python3-pytest-mock ;)

swh/loader/tests/test_cli.py
80 ↗(On Diff #8478)

Still this one to replace with mocker fixture

Migrate last test with mocker fixture (missed)