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

Adjust test_writer_bad_message for ujson #7

Closed
wants to merge 1 commit into from

Conversation

jelly
Copy link

@jelly jelly commented Aug 27, 2021

The correct timestamp value of
datetime.datetime(2019, 1, 1, 1, 1,1).timestamp() is 1546300861.

Closes: #6

The correct timestamp value of
`datetime.datetime(2019, 1, 1, 1, 1,1).timestamp()` is 1546300861.

Closes: python-lsp#6
@ccordoba12
Copy link
Member

Tests are failing precisely due to the change you made. What version of ujson are you trying to support with it?

@jelly
Copy link
Author

jelly commented Aug 29, 2021

Tests are failing precisely due to the change you made. What version of ujson are you trying to support with it?

Ah, that's curious, they fail here locally with python-ujson 4.1.0-1 on Python 3.9 which is also tested in CI

@ccordoba12
Copy link
Member

Our tests are also using ujson 4.1.0

@craftyguy
Copy link

craftyguy commented Sep 2, 2021

datetime.datetime(2019, 1, 1, 1, 1,1).timestamp() is 1546300861.

Hmm....

❯ python3 --version
Python 3.9.6
❯ python3 -c "import datetime; print(datetime.datetime(year=2019,month=1,day=1,minute=1,second=1).timestamp())"
1546329661.0

This test is also failing for me on Alpine Linux, but I get a different timestamp value than either @jelly or the expected value in the test 🤦🏽

Edit: if we're getting different values for timestamp, then it kind of seems like some timezone stuff is at play here...

@craftyguy
Copy link

ok I get @jelly's 'answer' (1546300861 ) for timestamp if I use calendar.timegm

import calendar
import datetime
d = datetime.datetime(year=2019,month=1,day=1,minute=1,second=1)
t = d.timetuple()
print(calendar.timegm(t))

Seems like the test is in fact broken.

itsbenweeks pushed a commit to itsbenweeks/python-lsp-jsonrpc that referenced this pull request Feb 1, 2022
@jelly jelly closed this Oct 15, 2024
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.

Test test_writer_bad_message fails with ujson
3 participants