Skip to content

pytest Tricks

Marius Rieder edited this page Feb 22, 2021 · 1 revision

Freez the time

  • Add pytest-freezegun to .devcontainer/requirements.txt
  • Installe the requirements pip3 install -r .devcontainer/requirements.txt
  • Use the freeze_time mark for the functions which require a fixed time
@pytest.mark.freeze_time('2021-02-19 18:00')
Clone this wiki locally