Fix two incorrect os.environ accesses in test setups.

This commit is contained in:
Chris Jerdonek 2019-02-02 11:46:42 -08:00
parent 57ec8bc5e0
commit c4a48f28f1
2 changed files with 2 additions and 6 deletions

View File

@ -82,9 +82,7 @@ class Test_base_command_logging(object):
def setup(self):
self.old_time = time.time
time.time = lambda: 1547704837.4
# Robustify the tests below to the ambient timezone by setting it
# explicitly here.
self.old_tz = getattr(os.environ, 'TZ', None)
self.old_tz = os.environ.get('TZ')
os.environ['TZ'] = 'UTC'
# time.tzset() is not implemented on some platforms (notably, Windows).
if hasattr(time, 'tzset'):

View File

@ -34,9 +34,7 @@ class TestIndentingFormatter(object):
"""
def setup(self):
# Robustify the tests below to the ambient timezone by setting it
# explicitly here.
self.old_tz = getattr(os.environ, 'TZ', None)
self.old_tz = os.environ.get('TZ')
os.environ['TZ'] = 'UTC'
# time.tzset() is not implemented on some platforms (notably, Windows).
if hasattr(time, 'tzset'):