PyCQA / flake8

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
https://flake8.pycqa.org
Other
3.39k stars 306 forks source link

B017 - Suppress warning when msg param is passed to assertRaises #1940

Closed slw07g closed 2 months ago

slw07g commented 2 months ago

describe the request

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.

sigmavirus24 commented 2 months ago

Flake8 does not define any checks or implement them which is clearly described in the issue template and documentation. Please find the correct place to file this instead