Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

hannesstruss opened this Issue December 21, 2012 · 1 comment

2 participants

Hannes Struß Steve Pulec
Hannes Struß

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.

Steve Pulec

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.

Steve Pulec spulec closed this January 10, 2013
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.