mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Do extra code style checks with flake8-bugbear
Flake8 Bugbear checks for some extra things that aren’t code style errors, but are likely to introduce bugs or unexpected behaviour. A good example is having mutable default function arguments, which get shared between every call to the function and therefore mutating a value in one place can unexpectedly cause it to change in another. This commit enables all the extra warnings provided by Flake8 Bugbear, except for: - the line length one (because we already lint for that separately) - B903 Data class should either be immutable or use `__slots__` because this seems to false-positive on some of our custom exceptions - B902 Invalid first argument 'cls' used for instance method because some SQLAlchemy decorators (eg `declared_attr`) make things that aren’t formally class methods take a class not an instance as their first argument It disables: - _B306: BaseException.message is removed in Python 3_ because I think our exceptions have a custom structure that means the `.message` attribute is still present Matches the work done in other repos: - https://github.com/alphagov/notifications-admin/pull/3172/files
This commit is contained in:
@@ -1475,7 +1475,7 @@ def test_send_inbound_sms_to_service_does_not_sent_request_when_inbound_api_does
|
||||
mocked = mocker.patch("requests.request")
|
||||
send_inbound_sms_to_service(inbound_sms.id, inbound_sms.service_id)
|
||||
|
||||
mocked.call_count == 0
|
||||
assert mocked.call_count == 0
|
||||
|
||||
|
||||
def test_send_inbound_sms_to_service_retries_if_request_returns_500(notify_api, sample_service, mocker):
|
||||
@@ -1525,7 +1525,7 @@ def test_send_inbound_sms_to_service_does_not_retries_if_request_returns_404(not
|
||||
status_code=404)
|
||||
send_inbound_sms_to_service(inbound_sms.id, inbound_sms.service_id)
|
||||
|
||||
mocked.call_count == 0
|
||||
assert mocked.call_count == 0
|
||||
|
||||
|
||||
def test_process_incomplete_job_sms(mocker, sample_template):
|
||||
|
||||
Reference in New Issue
Block a user