Run tests with a clean environment

Fixes various failing tests.