-
-
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
Add shift to TimeMachineFixture #247
Comments
Yes sure! |
I was thinking through what this api would be. In the case one has already called There are other cases where a test doesn't care about the actual time, simply that some time has elapsed. In this case a user might call @adamchainz what are your thoughts on this logic? And if you think it makes sense at all, is the fixture the right place for it? From a quick look at the code, I am not sure where else to put it, unless the travel class made the |
I see similar functionality has been proposed in #38. That seems like a good way to address my concern about putting entirely new functionality into the fixture, since the fixture could simply use a zero delta to initialize the |
@AgDude adding |
Isn't this done? |
Yup, thanks for noting. |
Description
It would be convenient if
TimeMachineFixture
supportedshift
in addition tomove_to
. You can work around the lack of this by doingtime_machine.coordinates.shift(...)
, but it's slightly more verbose and requires you to have already calledmove_to
. It also doesn't interact great with a typechecker since it will thinktime_machine.coordinates
could still beNone
even if you've calledmove_to
.Would a contribution for this feature be accepted?
Edit: It would also simplify migration from pytest-freezegun since there you have both
move_to
andtick
The text was updated successfully, but these errors were encountered: