Cleanup the logic for running optional tests.