freeze_time might leave some instances patched after exit
See original GitHub issueModule A gets imported inside freeze_time
context manager
Module A imports datetime.datetime
(patched with freezegun).
Context manager exists and unpatches all modules it has tracked in undo_changes
.
The problem is that module A still has FakeDatetime
instead of datetime.datetime
,
which results in something like that if it gets called:
return cls.times_to_freeze[-1]
IndexError: list index out of range
Sorry, I have no test to show this bug.
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Troubleshooting Patch Manager - AWS Documentation
Solution 2: Ensure that only one maintenance window at a time is running Run Command tasks ... Permission denied failed to run commands:...
Read more >Patching EC2 through SSM - Kloud Blog - Telstra Purple
Patch Baseline is configured as follows. Go to Patch Baseline and make the newly created baseline as your default. At this point, the...
Read more >How micropatching could help close the security update gap
One possible way to decrease time to patch is micropatching -- using a tiny piece of code to fix a single vulnerability, without...
Read more >Automatic VM Guest Patching for Azure VMs - Microsoft Learn
Learn how to automatically patch virtual machines in Azure. ... The patches can be installed any day on the VM during off-peak hours...
Read more >FAQs | ManageEngine Patch Manager Plus
Answers to some frequently asked questions in Patch Manager Plus. ... Can I schedule a reboot for a specific time after patches are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same issue with 0.3.7, I am using a pytest fixture that uses “freeze_time”:
One of the tests that does not use this fixture hits this issue when using structlog and datetime.utcnow():
If this can help, here is the code in structlog that gets and uses “utcnow”:
Here is my attempt to fix this: https://github.com/spulec/freezegun/pull/155