PyCQA / flake8-bugbear

A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
MIT License
1.05k stars 103 forks source link

B017 - assertRaises - ignore when msg param is passed #479

Open slw07g opened 1 week ago

slw07g commented 1 week ago

Consider suppressing B017 where msg= is passed to assertRaises, as it also validates the actual message in the raised exception matches msg.

Example: assertRaises(Exception, msg="Some exception message")

It is equivalent to assertRaisesRegex(Exception, "^<regex_pattern>$") which does not trigger B017.

slw07g commented 1 week ago

Opened an issue in the flake8 repo. https://github.com/PyCQA/flake8/issues/1940

slw07g commented 1 week ago

Reopening because maybe this is the right repo for the issue.