fixed test that patched but didn't restore os.environ