Also refactor related tests to avoid spending time discovering environments when the test doesn't need it.