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