flake8-bugbear icon indicating copy to clipboard operation
flake8-bugbear copied to clipboard

Improve unit test runner

Open JelleZijlstra opened this issue 2 years ago • 2 comments

This project's unit tests are sort of annoying to work with as you have to manually type out line numbers in the test file. This is especially bad if we reformat something and a bunch of line numbers change.

It would be nice to switch to flake8-pyi's setup or a variant (https://github.com/PyCQA/flake8-pyi/blob/main/tests/test_pyi_files.py), which puts the expected errors inline in the test files.

JelleZijlstra avatar Oct 28 '23 02:10 JelleZijlstra

It looks like bugbear's tests currently assert the column number an error occurs on, as well as the line number — you won't be able to do that with a flake8-pyi-esque setup.

I don't think that's a huge issue, though. Having also contributed to both projects, I agree that flake8-pyi's test suite is much nicer to work with! This sounds like a great idea.

AlexWaygood avatar Oct 28 '23 10:10 AlexWaygood

FWIW - We've at least disabled black on test code so we don't reformat and change numbers as much with formatting changes.

cooperlees avatar Jan 14 '24 05:01 cooperlees