Skip to content

Adjust test_writer_bad_message for ujson - #7

Closed
jelly wants to merge 1 commit into
python-lsp:developfrom
jelly:issues/6
Closed

jelly wants to merge 1 commit into
python-lsp:developfrom
jelly:issues/6

Conversation

@jelly

@jelly jelly commented Aug 27, 2021

Copy link
Copy Markdown

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
Copy Markdown
Member

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

@jelly

jelly commented Aug 29, 2021 •

Copy link
Copy Markdown
Author

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
Copy Markdown
Member

Our tests are also using ujson 4.1.0

@craftyguy

craftyguy commented Sep 2, 2021 •

Copy link
Copy Markdown

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
Copy Markdown

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