tests: better code for running flake8/unittest