-
-
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
String times get interpreted in a wrong way #348
Comments
This will be due to the way that dateutil parses the datetime, and probably interprets it with the current timezone: https://dateutil.readthedocs.io/en/stable/parser.html I've been considering removing the dateutil parsing in favour of simpler support with If the date was interpreted as a local date oject, would that help you? |
yes, it would be helpful |
No, freezegun uses dateutil, so this would be an incompatibility. |
mm yes but its behavior is correct with me class TempTest2(TestCase):
@freeze_time(datetime.datetime(2020, 6, 1, 0, 0, 0))
def test_time(self):
print(timezone.now())
self.assertEqual(datetime.date(2020, 6, 1), timezone.now().date())
self.assertEqual(timezone.now().date(), datetime.date(2020, 6, 1))
@freeze_time("2020-06-01")
def test_time2(self):
print(timezone.now())
self.assertEqual(datetime.date(2020, 6, 1), timezone.now().date())
self.assertEqual(timezone.now().date(), datetime.date(2020, 6, 1)) 2020-06-01 00:00:00+00:00
.2020-06-01 00:00:00+00:00
.
----------------------------------------------------------------------
Ran 2 tests in 0.119s
OK same tests |
See #306 . I actually prefer the interpretation of a string to be in the timezone from my settings. P.S. If it is changed, please treat it as a breaking change; because I have now written many of my tests using the current interpretation. |
Python Version
3.10
pytest Version
No response
Package Version
No response
Description
for some reason when using"2020-06-01" the time is getting wrong
The text was updated successfully, but these errors were encountered: