# python
-
Testing with pendulum
My usual way of modifying the behaviour of
pendulum.now()when testing has been to mock it:with mock.patch( "pendulum.now", return_value=pendulum.parse("2020-01-01 00:00:00") ): ...However, I did something mad today, and delved into the docs and found a neater way:
with pendulum.test(pendulum.parse("2020-01-01 00:00:00")): -
HTTPretty test hanging on Travis
nosetests that use HTTPretty don’t exit cleanly on Travis CI. An answer on Stack Overflow reveals the problem and a simple workaround.