3
from twisted.trial.unittest import TestCase
6
class TXAWSTestCase(TestCase):
7
"""Support for isolation of txaws tests."""
13
def stash_environ(self):
14
self.orig_environ = dict(os.environ)
15
self.addCleanup(self.restore_environ)
16
if 'AWS_ACCESS_KEY_ID' in os.environ:
17
del os.environ['AWS_ACCESS_KEY_ID']
18
if 'AWS_SECRET_ACCESS_KEY' in os.environ:
19
del os.environ['AWS_SECRET_ACCESS_KEY']
21
def restore_environ(self):
22
for key in set(os.environ) - set(self.orig_environ):
24
os.environ.update(self.orig_environ)