Page MenuHomeSoftware Heritage

exceptions: custom error response
ClosedPublic

Authored by DanSeraf on Mar 10 2020, 12:11 PM.

Details

Summary

Print an error message based on http response (T2300)

Diff Detail

Repository
rDTSCN Code scanner
Branch
response-api-error
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 11037
Build 16623: tox-on-jenkinsJenkins
Build 16622: arc lint + arc unit

Event Timeline

Now that swh-scanner has tests, it would be nice if every new feature and bugfix added (or changed) one or more tests.

swh/scanner/exceptions.py
12–14

nitpick: inconsistent casing, and s/request/requests/

19

You can probably use resp.reason instead of status_code_msg[resp.status]

This revision now requires changes to proceed.Mar 10 2020, 12:18 PM

Now that swh-scanner has tests, it would be nice if every new feature and bugfix added (or changed) one or more tests.

Yes, i'll write test also on this one

assert APIError raises when the payload is too large
live_server override, only one per session
vlorentz added inline comments.
swh/scanner/tests/conftest.py
63–66

slightly confusing, but ok.

Maybe a comment?

swh/scanner/tests/test_scanner.py
45

You can also use the match argument in APIError to check the reason is there, but that's not very important

This revision is now accepted and ready to land.Mar 10 2020, 7:50 PM
swh/scanner/tests/conftest.py
63–66

there is no need of overriding the live_server so i'll remove the no-start-live-server option in pytest.ini

removed --no-start-live-server option in pytest.ini