Roughly, the idea is that http queries are transformed into file queries
within http context. If found, the data file is served or not (404). This
translates into query response so that the code can actually complete as usual.
For technical reasons the pytest plugin is in a dedicated non-swh module. This
is actually required for the pytest plugin loading mecanism to work without
hijacking the loading of swh packages. See [1] for more details.
[1] https://github.com/pytest-dev/pytest/issues/2042
For sample use cases, see for examples:
- lister:
- D2074
- D2076
- D2077
- loader-package:
- https://forge.softwareheritage.org/source/swh-loader-core/browse/package-loader/swh/loader/package/tests/test_gnu.py$198
- https://forge.softwareheritage.org/source/swh-loader-core/browse/package-loader/swh/loader/package/tests/test_npm.py$406
- https://forge.softwareheritage.org/source/swh-loader-core/browse/package-loader/swh/loader/package/tests/test_pypi.py$191
- https://forge.softwareheritage.org/source/swh-loader-core/browse/package-loader/swh/loader/package/tests/test_deposit.py$66-67
Note:
The fixture's name is not that good, if you have any better idea, now is the time ;)