Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-130197: Improve test coverage ofmsgfmt.py#133048

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
serhiy-storchaka merged 4 commits intopython:mainfromtomasr8:msgfmt-parse-tests
May 1, 2025

Conversation

tomasr8
Copy link
Member

@tomasr8tomasr8 commentedApr 27, 2025
edited by bedevere-appbot
Loading

I am using#130197 for this because it relates to#131381

The current msgfmt parser is not fully compliant and has several bugs despite a few having been fixed already. The parser code is also not very maintainable in its current form so I'd like to modernize it and make it more reliable. A reliable PO parser will also be useful for the--exclude-file option inpygettext (see#131381).

Before we make any sweeping changes, I want to first increase the test coverage which is currently really low. This will help us document the discrepancies of the current parser and ensure we don't regress when we update the parser later on.

This is just the first PR which adds string tests. More PRs will follow to test other parts of the PO parser.

@bedevere-appbedevere-appbot added awaiting review testsTests in the Lib/test dir labelsApr 27, 2025
@bedevere-appbedevere-appbot mentioned this pull requestApr 27, 2025
18 tasks
@tomasr8
Copy link
MemberAuthor

Do you think you could have a look Serhiy?

Copy link

@auvipyauvipy left a comment

Choose a reason for hiding this comment

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

the tests looks good on first review

tomasr8 reacted with thumbs up emoji
Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

I'm afraid these tests take too much time (compared to their importance). A new process is started for each use case. Could you optimize them?

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM.

@tomasr8
Copy link
MemberAuthor

Could you optimize them?

Definitely, the overhead was about 3 seconds on my machine which is a lot. I changed it ina9bdce8 to importmsgfmt directly instead of spawning a subprocess.

Note that we need to reset the globalMESSAGES dictionary after each invocation since msgfmt keeps message data in a global variable.

The difference after the change is basically just random noise:

on main:

~ ./pythonLib/test/test_tools/test_msgfmt.py.............----------------------------------------------------------------------Ran13testsin1.302s

ona9bdce8:

~ ./pythonLib/test/test_tools/test_msgfmt.py                                                                                                                                                  ..............----------------------------------------------------------------------Ran14testsin1.305s

@tomasr8
Copy link
MemberAuthor

LGTM.

Ah you are too fast 😆

@serhiy-storchakaserhiy-storchakaenabled auto-merge (squash)May 1, 2025 13:12
@serhiy-storchakaserhiy-storchaka merged commitc73d460 intopython:mainMay 1, 2025
42 checks passed
@tomasr8tomasr8 deleted the msgfmt-parse-tests branchMay 1, 2025 13:38
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbotAMD64 FreeBSD14 3.x (tier-3) has failed when building commitc73d460.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1232/builds/5601) and take a look at the build logs.
  4. Check if the failure is related to this commit (c73d460) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1232/builds/5601

Failed tests:

  • test_interpreters

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):  File"/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/threading.py", line1079, in_bootstrap_innerself._context.run(self.run)~~~~~~~~~~~~~~~~~^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/threading.py", line1021, inrunself._target(*self._args,**self._kwargs)~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/test/test_interpreters/test_stress.py", line30, intask    interp= interpreters.create()  File"/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/test/support/interpreters/__init__.py", line76, increateid= _interpreters.create(reqrefs=True)interpreters.InterpreterError:interpreter creation failedk

@serhiy-storchakaserhiy-storchaka added the needs backport to 3.13bugs and security fixes labelMay 1, 2025
@miss-islington-app
Copy link

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

@miss-islington-app
Copy link

Sorry,@tomasr8 and@serhiy-storchaka, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker c73d46076ee0a6f32b472f9dfcf0e4245cc1c462 3.13

tomasr8 added a commit to tomasr8/cpython that referenced this pull requestMay 1, 2025
…133048)(cherry picked from commitc73d460)Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
@bedevere-app
Copy link

GH-133255 is a backport of this pull request to the3.13 branch.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

@auvipyauvipyauvipy approved these changes

Labels
skip newstestsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@tomasr8@bedevere-bot@serhiy-storchaka@auvipy

[8]ページ先頭

©2009-2025 Movatter.jp