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

Feature request: allow it to accept no datetime and default to utcnow #486

Open
gdalmau opened this issue Jan 23, 2023 · 0 comments
Open

Comments

@gdalmau
Copy link

gdalmau commented Jan 23, 2023

Description

It would be good to be able to use this context manager/decorator as a way to tell the tests to just freeze time without having to specify any datetime.

Currently it accepts None as a possible value and it defaults to .utcnow(), so it looks like the implementation should be trivial:

freezegun/freezegun/api.py

Lines 460 to 465 in 33fdce8

def _parse_time_to_freeze(time_to_freeze_str):
"""Parses all the possible inputs for freeze_time
:returns: a naive ``datetime.datetime`` object
"""
if time_to_freeze_str is None:
time_to_freeze_str = datetime.datetime.utcnow()

@gdalmau gdalmau changed the title Feature request: accept no time Feature request: allow it to accept no datetime and default to utcnow Jan 23, 2023
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

No branches or pull requests

1 participant