…t just fail gracefully with non-function callables
Special objects that overrides __eq__ which always returns True confuses the replacement. Checking for the replacement functions by identity solves this problem. Equal (==) does identity comparisions anyways unless __eq__ is overriden.
`functools.update_wrapper` and `functools.wraps` sets `__wrapped__` in Python >= 3.2, so this fix only affects Python 2.X in freezegun. The mock library uses a similar fix: https://code.google.com/p/mock/source/browse/mock.py?spec=svnd356250e275daa62b2972521885f42fa639341e6&r=e7c5f97dc1b486fbf2e7fb111ec3e6675f9d3418#65 This change allows pytest to correctly figure out the real argument names and then inject fixtures properly: https://bitbucket.org/hpk42/pytest/src/d91265465608bd3777ab0c882e5d68335d7472dd/_pytest/python.py?at=default#cl-1916
The FakeDateMeta metaclass addition made some assertions "always valid": the issubclass(obj, FakeDatetime) returns true both for fake and original datetime objects. To fix it a new set of helper functions was added. They test for exact obj.__class__ match instead.
…ess setUp doesn't break things
… info ...rather than a FakeDate. datetime.datetime.today() is effectively an alias for datetime.datetime.now(tz=None), but freezegun was returning a FakeDate object instead of a FakeDateTime.
This just increases the chance that the user will have a usable locale on his system.
The standard unittest module only got SkipTest from Python 2.7.
When a date or datetime object is passed to freeze_time, it is converted to a string which is then later parsed with dateutil. The conversion was done using the '%x' format character, which return the appropriate date representation for the current locale. This means that you get '01/02/13' for January 2nd with the C and en_US locales, and '02/01/13' for the same date using most European locales. The string is then parsed incorrectly by dateutils. Using the isoformat method on date/datetime objects solves this by returning a string in 'yyyy-mm-dd' format. This string is parsed correctly by dateutil, regardless of the current locale.