Is there a way to prevent a test from running if the setup will say so?

Is there a way to prevent a test from running if the setup will say so?

Is there a way to prevent a test from running if the setup will say so? Currently the way I implement this is I have an outside variable that I set to true or false depending on whether I want the test to run and I check this variable in the test before I begin to run the rest of it. This is not elegant but I can't find another way.

The reason that I do this is during setup I need to make an async call to clean the contents of a table and if that doesn't finish on time I need to not run the test.