Run script under faketime

In Linux, there is this nice little command line tool called "faketime" (see, e.g., https://www.systutorials.com/docs/linux/man/1-faketime/). It let's you run a program with a different system time, so, e.g.

faketime '2008-12-24 08:15:42' python test.py

starts test.py, but for the script the current time is the one given as a parameter. After the start, the time progresses as normal, so this is perfect for testing code that depends on the actual time.

Is it possible to run a script within PyCharm like that? How?

1 comment

You can try using external tools, calling `faketime` as a program, and passing `python <script_name>` as arguments using macro...

https://www.jetbrains.com/help/pycharm/settings-tools-external-tools.html

But no guarantees, unfortunately

0

Please sign in to leave a comment.