In some of my tests I am having a problem that they fail on Travis because of time and time zone problems, so I want to mock system time for my test. How can I do this?
@Brian-Kruger's answer is the best one. I've voted to undelete it. In the meantime...
Use freezegun (repo).
From the README:
from freezegun import freeze_time @freeze_time("2012-01-14") def test(): assert datetime.datetime.now() == datetime.datetime(2012, 1, 14)