This commit is contained in:
jb-alvarado 2021-02-11 09:28:15 +01:00
parent 0192240f85
commit 1793c57376

View File

@ -10,18 +10,14 @@ import time_machine
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
_tz = ZoneInfo("Europe/Berlin") # set time zone
source_time = [2021, 2, 8, 23, 59, 50] _TZ = ZoneInfo("Europe/Berlin")
# fake date and time
SOURCE_TIME = [2021, 2, 8, 23, 59, 50]
@time_machine.travel(datetime.datetime(*source_time, tzinfo=_tz)) @time_machine.travel(datetime.datetime(*SOURCE_TIME, tzinfo=_TZ))
def run_in_time_machine(): def run_in_time_machine():
try:
assert datetime.datetime.now() == datetime.datetime(*source_time)
except AssertionError:
print('Assertion not possible')
exit()
desktop.output() desktop.output()