mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
fail2ban-testcases: persistently set (python) time zone to CET during test cases process (used in zone-related test-cases)
This commit is contained in:
parent
c8b036456d
commit
58717c1854
1 changed files with 4 additions and 7 deletions
|
|
@ -260,6 +260,10 @@ def initTests(opts):
|
|||
raise unittest.SkipTest('Skip test because of "--no-network"')
|
||||
unittest.F2B.SkipIfNoNetwork = F2B_SkipIfNoNetwork
|
||||
|
||||
# persistently set time zone to CET (used in zone-related test-cases),
|
||||
# yoh: we need to adjust TZ to match the one used by Cyril so all the timestamps match
|
||||
os.environ['TZ'] = 'Europe/Zurich'
|
||||
time.tzset()
|
||||
# set alternate now for time related test cases:
|
||||
MyTime.setAlternateNow(TEST_NOW)
|
||||
|
||||
|
|
@ -292,17 +296,10 @@ old_TZ = os.environ.get('TZ', None)
|
|||
def setUpMyTime():
|
||||
# Set the time to a fixed, known value
|
||||
# Sun Aug 14 12:00:00 CEST 2005
|
||||
# yoh: we need to adjust TZ to match the one used by Cyril so all the timestamps match
|
||||
os.environ['TZ'] = 'Europe/Zurich'
|
||||
time.tzset()
|
||||
MyTime.setTime(TEST_NOW)
|
||||
|
||||
|
||||
def tearDownMyTime():
|
||||
os.environ.pop('TZ')
|
||||
if old_TZ: # pragma: no cover
|
||||
os.environ['TZ'] = old_TZ
|
||||
time.tzset()
|
||||
MyTime.myTime = None
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue