Fix for py.test

In order for freeze gun to play well with py.test

The issue is that some modules apparently don't have a __name__ (it appears to be lazy loaded) Just adding a check for the __name__ attribute before trying to access it.

Test case showing that freezegun and py.test didn't work well together. https://gist.github.com/PuercoPop/5357159