KEMBAR78
gh-53203: Fix test_strptime on Solaris by serhiy-storchaka · Pull Request #125785 · python/cpython · GitHub
Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Oct 21, 2024

@serhiy-storchaka
Copy link
Member Author

@kulikjak, please check if these tests are passed on Solaris.

def test_date_time_locale2(self):
# Test %c directive
loc = locale.getlocale(locale.LC_TIME)[0]
if sys.platform.startswith(('sunos', 'solaris')):
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be safely just 'sunos'. AFAIK, neither Oracle nor OpenSolaris forks will report 'solaris' here.

self.roundtrip('%c', slice(0, 6), (1800, 1, 1, 0, 0, 0, 0, 1, 0))
except ValueError:
if 'LMT' in time.strftime('%c', (1800, 1, 1, 0, 0, 0, 0, 1, 0)):
self.skipTest('different timezone in the past is not supported')
Copy link
Contributor

Choose a reason for hiding this comment

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

When implemented this way, all the tests look like skipped (because there is always a 'LMT' zone when running the test for 1800), even though the 1900 round trip already passed. But I don't really mind that - I just noticed it :).

Copy link
Member Author

Choose a reason for hiding this comment

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

This is because you run tests in a place where LMT was in 1800.

Please check the tests again, now with a fixed timezone.

def test_date_locale2(self):
# Test %x directive
loc = locale.getlocale(locale.LC_TIME)[0]
if sys.platform.startswith(('sunos', 'solaris')):
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@kulikjak
Copy link
Contributor

Thank you. I tested the patch and it works.

(I was a little surprised that all the skips matched what I found.)

@serhiy-storchaka
Copy link
Member Author

(I was a little surprised that all the skips matched what I found.)

I looked in the illumos locale data.

@kulikjak
Copy link
Contributor

Now it works.

I'd suggest adding a comment or updating the skip message with the reason (the year has only two digits), but that is just a detail. Thank you for all the fixes!

I looked in the illumos locale data.

Ah, makes sense.

@serhiy-storchaka serhiy-storchaka merged commit 9dde463 into python:main Oct 21, 2024
33 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the test_strptime branch October 21, 2024 19:17
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 21, 2024
Use fixed timezone.
Skip roundtrip tests on locales with 2-digit year.
(cherry picked from commit 9dde463)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 21, 2024
Use fixed timezone.
Skip roundtrip tests on locales with 2-digit year.
(cherry picked from commit 9dde463)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Oct 21, 2024

GH-125806 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 21, 2024
@bedevere-app
Copy link

bedevere-app bot commented Oct 21, 2024

GH-125807 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 21, 2024
serhiy-storchaka added a commit that referenced this pull request Oct 21, 2024
Use fixed timezone.
Skip roundtrip tests on locales with 2-digit year.
(cherry picked from commit 9dde463)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Oct 21, 2024
Use fixed timezone.
Skip roundtrip tests on locales with 2-digit year.
(cherry picked from commit 9dde463)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
Use fixed timezone.
Skip roundtrip tests on locales with 2-digit year.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants