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

Update datetime.py and test_datetime.py to CPYTHON v3.11.2 #5018

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bobby-palmer
Copy link
Contributor

I also had to add _strptime.py but test_datetime.py fails due to incorrect datetime struct implementation in time.rs
Contributing to issue : #4564

Lib/test/test_datetime.py Outdated Show resolved Hide resolved
@bobby-palmer
Copy link
Contributor Author

Thanks for the feedback. Do you know why the tests are failing?

TESTS = 'test.datetimetester'

@unittest.skip("TODO: RUSTPYTHON, incorrect datetime struct implementation in time.rs")
def load_tests(loader, tests, pattern):
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe you can skip this. This function is part of the load_tests protocol and generates the test suite to be executed.

If you unskip this what is the error?

Copy link
Member

Choose a reason for hiding this comment

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

I can take a look later since am on mobile now. There's probably a reason this file wasn't already added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when it loads _strptime.py I get an error of no attribute : tzinfo so I guess ill have to fix that before I can add these. On that topic, could you point me in the right direction for creating a field for the time_struct that may of may not be present for a given instance (naive vs timezone aware time struct)

Copy link
Member

Choose a reason for hiding this comment

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

aha, gotcha. Makes sense to remove this file for now and see how the updates play with the rest of the test suite.

could you point me in the right direction for creating a field for the time_struct that may of may not be present for a given instance

It being an Option seems like the way to go, the docs state it as optional and looking through Python code I'm seeing it being guarded by if tzinfo is None all over the place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you know how I would go about making it so that when the option is none the python object no longer has that attribute? I still don't fully understand how pystructsequence works.

@bobby-palmer bobby-palmer marked this pull request as draft June 22, 2023 21:14
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.

None yet

3 participants