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'):