Correctly evaluate the test kwarg when running a state.
Merge pull request #8141 from cachedout/#7788

Correctly evaluate the test kwarg when running a state.