-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Complete copying freezegun API #20
Comments
@adamchainz do you need help with implementing |
Help with any of it would be great! These methods should all be implementable in the python side of things so no need to dive into the C. No particular idea right now, show me what you come up with! |
Refs #20. Co-authored-by: alex-verve <alex.subbotin@pollen.co> Co-authored-by: Adam Johnson <me@adamj.eu>
I've closed #14 because I don't want to add |
There is an For now I'm using workaround like following: from contextlib import contextmanager
from time_machine import coordinates_stack
@contextmanager
def disable_time_machine():
global coordinates_stack
original_coordinates_stack = coordinates_stack.copy()
coordinates_stack.clear()
yield
coordinates_stack.extend(original_coordinates_stack) |
The only way we could implement it would be through stack inspection to find the caller, and I don't think it's worth that level of complexity. If you need to disable time-machine for a block of code you can wrap just certain blocks of code with the context manager, or use the start/stop API. You could also possibly work around it with an inner travel() to the current time - possibly we could support |
|
FYI you can use the |
Decided not to wrap non- |
.tick()
method.move_to()
methodauto_tick_seconds
(?) - Add auto_tick_seconds #14test_
(or a configurable prefix) are wrapped, rather than the unnecessary, perhaps dangerous "wrap every callable" behaviour freezegun uses.The text was updated successfully, but these errors were encountered: