abseil/abseil-py

Running all absltest test files using flags

joeltine opened this issue · 1 comments

Hi,

I have a bunch of *_test.py files in my project using absltest.TestCase and I'd like to be able to run them all with a single command. The issue is that the typical unittest discovery method of python3 -m unittest discover -p '_test.py' -v does not work as it doesn't run absltest.main() and flag parsing never occurs (my code uses flags heavily).

This issue was described in #138 but no alternative was given to running the entire suite of tests using flags. Should I just write my own custom script that globs the *_test.py files and executes them? Thanks.

Ended up doing this with a top level run_all_tests.py script that uses unittest.TestLoader.discover to create a test suite and pass that to unittest.TextTestRunner.