-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Freeze Time doesn't freeze time #12
Comments
I've just that If I swap the order of the import the testcase works fine, but from the pep8
|
Yes, this is a known limitation of the library (there's a warning in the README). The other workaround involves just importing the datetime module and using that instead of importing classes from the module. Sorry that there's not currently a better answer. |
The warning in the README is gone, but this is still failing for me. |
Are you running this exact code? It works on my local machine. If you are using this exact code, can you let me know some more details about your setup? Python version, OS, freezegun version, etc. If you are not using this exact code, can you show me the code you are using? |
That code works, but this, for instance, fails:
...whereas importing datetime.datetime after the call to
I have similar issues using the I'm on Mac OSX 10.10, python 2.7.1, freezegun 0.2.2. |
Okay. So I think the problem here is the aliasing of the datetime import as The following code works: from freezegun import freeze_time
from datetime import datetime
freezer = freeze_time('1980-01-01')
freezer.start()
assert datetime.now() == datetime(1980,1,1) This is definitely a bug, but I want to spend some time figuring out the best way to fix it. I've opened a new issue for this at #64. Thanks for reporting it. |
Awesome, thanks! |
I have pushed a fix to master that I think will address this. Can you give it a test? |
That was extremely fast, and it works. Thanks a lot for fixing this! |
Sorry for the lousy Issue title, I don't know how to frase it, but the test case is pretty clear.
Test Case: https://gist.github.com/PuercoPop/4724228
The text was updated successfully, but these errors were encountered: