Doing it in the `teardown` wouldn't make any difference.  It would still have the same problem.  The trouble is that the ENV variables are global state that's not reset in any way by the test framework.

I don't think any tests should rely on these ENV variables being implicitly set.  It they're needed in a test, then it's up to that test to set them.