Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Print a warning when datetime can't be patched #7

hannesstruss opened this Issue · 1 comment

2 participants


It would be very cool if a warning was printed (or even an error was raised) when the patching can't be performed properly, e.g.. because of a wrong import order.

Alternatively something like freezegun.assert_can_patch() would be handy, raising an error when datetime was imported before and can't be patched properly.


Hi Hannes. I really like the idea, but don't think there is an easy way to do this with how the code is setup. One thing you can do is

from freezegun.api import FakeDatetime
now =
assert isinstance(now, FakeDatetime)

If you can think of an easy way to do this, please reopen this issue because I would love to have it.

@spulec spulec closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.