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

gh-53203: Fix test_strptime on Solaris #125785

Merged
merged 2 commits into from
Oct 21, 2024

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.

@@ -521,8 +521,17 @@ def test_date_time_locale(self):
'my_MM', 'shn_MM')
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.

@@ -553,6 +562,10 @@ def test_date_locale(self):
'eu_ES', 'ar_AE', 'my_MM', 'shn_MM')
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 <[email protected]>
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 <[email protected]>
@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 bug and 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 <[email protected]>
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 <[email protected]>
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