import os
import mock
with mock.patch.dict('os.environ'):
    del os.environ['PATH']
print('PATH' in os.environ)
print('PATH' in os.environ)
Using python's mock to temporarily delete an object from a dict