Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_reload(self):
os.environ['TZ'] = 'Africa/Harare'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# Changing the TZ makes no difference, because it's cached
os.environ['TZ'] = 'Africa/Johannesburg'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# So we reload it
tz_harare = tzlocal.unix.reload_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Johannesburg')
def test_get_reload(self):
os.environ['TZ'] = 'Africa/Harare'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# Changing the TZ makes no difference, because it's cached
os.environ['TZ'] = 'Africa/Johannesburg'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# So we reload it
tz_harare = tzlocal.unix.reload_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Johannesburg')
def test_get_reload(self):
os.environ['TZ'] = 'Africa/Harare'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# Changing the TZ makes no difference, because it's cached
os.environ['TZ'] = 'Africa/Johannesburg'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# So we reload it
tz_harare = tzlocal.unix.reload_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Johannesburg')
def test_get_reload(self, atomock):
# Clear any cached zone
tzlocal.unix._cache_tz = None
os.environ['TZ'] = 'Africa/Harare'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# Changing the TZ makes no difference, because it's cached
os.environ['TZ'] = 'Africa/Johannesburg'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# So we reload it
tz_harare = tzlocal.unix.reload_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Johannesburg')
def test_get_reload(self):
os.environ['TZ'] = 'Africa/Harare'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# Changing the TZ makes no difference, because it's cached
os.environ['TZ'] = 'Africa/Johannesburg'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# So we reload it
tz_harare = tzlocal.unix.reload_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Johannesburg')
def test_get_reload(self):
os.environ['TZ'] = 'Africa/Harare'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# Changing the TZ makes no difference, because it's cached
os.environ['TZ'] = 'Africa/Johannesburg'
tz_harare = tzlocal.unix.get_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Harare')
# So we reload it
tz_harare = tzlocal.unix.reload_localzone()
self.assertEqual(tz_harare.zone, 'Africa/Johannesburg')