From c4a48f28f15d4d1603dd05b3dde1c60d4d9d87ac Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Sat, 2 Feb 2019 11:46:42 -0800 Subject: [PATCH] Fix two incorrect os.environ accesses in test setups. --- tests/unit/test_base_command.py | 4 +--- tests/unit/test_logging.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/unit/test_base_command.py b/tests/unit/test_base_command.py index e25df4a80..f90aaadf2 100644 --- a/tests/unit/test_base_command.py +++ b/tests/unit/test_base_command.py @@ -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'): diff --git a/tests/unit/test_logging.py b/tests/unit/test_logging.py index af70f568f..6d72bf623 100644 --- a/tests/unit/test_logging.py +++ b/tests/unit/test_logging.py @@ -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'):