Skip to content
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

Implement move_to #39

Merged
merged 1 commit into from
Jul 8, 2020
Merged

Implement move_to #39

merged 1 commit into from
Jul 8, 2020

Conversation

RealOrangeOne
Copy link
Contributor

Contributes towards #20

Copy link
Owner

@adamchainz adamchainz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this.

Your PR was missing docs and a changelog note. When engaging with open source projects please try to figure out how the project maintains its documentation and add them in the same way. It really helps with maintenance. One day I will get around to adding a contribution guide to my repos to say this.

I'm adding the changelog and docs, and test improvements in a follow-up PR.

def test_move_to_datetime_when_tick():
with time_machine.travel(EPOCH, tick=True) as traveller:
traveller.move_to(EPOCH_PLUS_ONE_YEAR_DATETIME)
assert time.time() == pytest.approx(EPOCH_PLUS_ONE_YEAR)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approx not as good as using the 'bounds checking' method in the other tests (<=) because it's not clear how many decimal places are checked, and it would potentially allow time to tick backwards

@adamchainz adamchainz merged commit bff3e9b into adamchainz:master Jul 8, 2020
@adamchainz adamchainz mentioned this pull request Jul 8, 2020
@adamchainz
Copy link
Owner

Released in version 1.2.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants