GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-126384: Add tests to verify the behavior of basic COM methods. by junkmd · Pull Request #126610 · python/cpython

Conversation

@junkmd

@junkmd junkmd commented Nov 9, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I would like to backport this to 3.12 and 3.13 as well.
This is internal-only, so I don’t think it needs a NEWS entry.

  • Issue: Add tests to verify the behavior of basic COM methods. #126384

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
junkmd added 2 commits November 9, 2024 02:49
@junkmd
Add tests.
ff06232
@junkmd
Add comments.
8049c1a
@bedevere-app bedevere-app Bot added tests Tests in the Lib/test dir awaiting review labels Nov 9, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Nov 9, 2024
Add tests to verify the behavior of basic COM methods. #126384
Closed
junkmd added 2 commits November 9, 2024 03:15
@junkmd
Add the platform bridge.
c85bd93
@junkmd
Update IsEqualGUID.
f77b18d
@junkmd junkmd mentioned this pull request Nov 9, 2024
ctypes: Make COMError, mentioned in the "Function prototypes" section of documentation, public. #126615
Closed
@ZeroIntensity ZeroIntensity added skip news topic-ctypes labels Nov 10, 2024
junkmd added 3 commits November 10, 2024 11:36
@junkmd
Improve naming.
c43dfa4
@junkmd
Add comments.
be31c06
@junkmd
Add comments for typing.
c09a6a1
@junkmd

junkmd commented Nov 10, 2024

Copy link
Copy Markdown
Contributor Author

I renamed utility functions for testing to conform with PEP8.

Also I added URLs in comments to documentation on COM specifications for developers who may have limited experience with COM and may review or maintain this code in the future.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@junkmd junkmd mentioned this pull request Nov 11, 2024
gh-126615: Make COMError public and add to ctypes doc. #126686
Merged
encukou
encukou reviewed Nov 18, 2024
View reviewed changes
Comment thread Lib/test/test_ctypes/test_win32_com_foreign_func.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

encukou
encukou reviewed Nov 18, 2024
View reviewed changes
Comment thread Lib/test/test_ctypes/test_win32_com_foreign_func.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

encukou
encukou reviewed Nov 18, 2024
View reviewed changes

@encukou encukou left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thank you for the tests!
I only have a slight idea of how COM works, but, they look good to me!

However, I would like to simplify the supporting Python code, though: we don't need to test CPython internal types, or custom descriptors using __get_name__.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

junkmd reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
junkmd added 3 commits November 18, 2024 14:12
@junkmd
Improve platform bridges.
f96a1ee
@junkmd
ProtoComMethod -> create_proto_com_method
c90ae51
@junkmd
WindowsError -> OSError
cc07c44
@junkmd
junkmd requested a review from encukou November 18, 2024 14:49
@junkmd

junkmd commented Nov 20, 2024

Copy link
Copy Markdown
Contributor Author

In #126686, COMError became public, but I would like this test to be backported to 3.13 and 3.12, where COMError remains private.

If possible, I would appreciate it if we could merge this as is, and after the backport PR is submitted by the bot, I will prepare a follow-up PR reflecting the fact that COMError is now public.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz
picnixz reviewed Nov 21, 2024
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Can we have assertion equality being tested as actual == expected instead of expected == actual? I think we usually do the first form rather than the second one.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_ctypes/test_win32_com_foreign_func.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

encukou
encukou approved these changes Nov 21, 2024
View reviewed changes

@encukou encukou left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good, thank you!

I don't think it's worth it to reorder assertion arguments, but if you want to do it I won't stop you :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Nov 21, 2024
@encukou

encukou commented Nov 21, 2024

Copy link
Copy Markdown
Member

[Edit: I deleted a misguided suggestion]

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Nov 21, 2024

Copy link
Copy Markdown
Member

!buildbot Windows

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Nov 21, 2024

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit cc07c44 🤖

The command will test the builders whose names match following regular expression: Windows

The builders matched are:

  • ARM64 Windows Non-Debug PR
  • AMD64 Windows11 Bigmem PR
  • AMD64 Windows10 PR
  • AMD64 Windows11 Non-Debug PR
  • AMD64 Windows Server 2022 NoGIL PR
  • AMD64 Windows11 Refleaks PR
  • ARM64 Windows PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@junkmd

junkmd commented Nov 21, 2024

Copy link
Copy Markdown
Contributor Author

I don’t have a strong preference for the order of actual == expected or expected == actual.
If it’s mergeable as is, please go ahead and merge it.

In my native language, Japanese, the equivalent concept is expressed as “予実” (yojitsu), with the characters for “expected” and “actual” written in that order.
That might be why I wrote it in this order.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz
picnixz approved these changes Nov 21, 2024
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Let's not burden ourselves with an additional commit. I was just surprised to see it written like that but I won't die from it :) (and since it's a new file anyway, it can have its own style).

By the way, do we need a if __name__ == '__main__' block executing the unittest as is?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

encukou and junkmd reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@junkmd
Add if __name__ == '__main__'
6c60512
@junkmd

junkmd commented Nov 21, 2024

Copy link
Copy Markdown
Contributor Author

I added the block.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz

picnixz commented Nov 21, 2024

Copy link
Copy Markdown
Member

Ah thank you. I wasn't sure whether it was needed or not. But one build bot is failing I think?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@junkmd

junkmd commented Nov 21, 2024

Copy link
Copy Markdown
Contributor Author

I’m not sure which bot you’re referring to, but all the CI checks have passed, and there’s a green ✔ as well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz

picnixz commented Nov 21, 2024

Copy link
Copy Markdown
Member

!buildbot Windows

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Nov 21, 2024

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @picnixz for commit 6c60512 🤖

The command will test the builders whose names match following regular expression: Windows

The builders matched are:

  • ARM64 Windows Non-Debug PR
  • AMD64 Windows11 Bigmem PR
  • AMD64 Windows10 PR
  • AMD64 Windows11 Non-Debug PR
  • AMD64 Windows Server 2022 NoGIL PR
  • AMD64 Windows11 Refleaks PR
  • ARM64 Windows PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@junkmd

junkmd commented Nov 21, 2024

Copy link
Copy Markdown
Contributor Author

I misunderstood the type of bot running in CI.
I thought all the bots specified with !buildbot Windows were running in CI.

I’m not sure why the bot is failing.
There are no changes to production code this time.
Looking at the bot’s traceback, it seems that something related to f-strings isn’t working correctly, but the test code I added this time doesn’t use any f-strings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@junkmd
Merge branch 'main' into add_com_method_tests
f0d3ede
@junkmd

junkmd commented Nov 22, 2024

Copy link
Copy Markdown
Contributor Author

!buildbot Windows

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Nov 22, 2024

Copy link
Copy Markdown

You don't have write permissions to trigger a build

junkmd reacted with confused emoji
All reactions
  • 😕 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Nov 22, 2024

Copy link
Copy Markdown
Member

Sorry, I had to step away yesterday.

By the way, do we need a if name == 'main' block executing the unittest as is?

No, that's not necessary in new tests. But it doesn't hurt.

I misunderstood the type of bot running in CI.

The Buildbot tests run after merge, as they can be slow or unreliable. And they run on volunteer-maintained hardware; for security we only run them on reviewed code.
I triggered them in order to check the test on several versions of Windows, e.g. 32-bit or ARM.
Sometimes they find issues in uncommon setups. Usually, some fail for unrelated reasons; those can be ignored. (GitHub unfortunately shows a scary-looking red message if any reported tests fail.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou
encukou merged commit 7725c03 into python:main Nov 22, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 22, 2024
@encukou encukou added needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Nov 22, 2024
@miss-islington-app

miss-islington-app Bot commented Nov 22, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app

miss-islington-app Bot commented Nov 22, 2024

Copy link
Copy Markdown

Thanks @junkmd for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2024
@junkmd @miss-islington
pythongh-126384: Add tests to verify the behavior of basic COM method…
8670935
…s. (pythonGH-126610)

(cherry picked from commit 7725c03)

Co-authored-by: Jun Komoda <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2024
@junkmd @miss-islington
pythongh-126384: Add tests to verify the behavior of basic COM method…
9262ef8
…s. (pythonGH-126610)

(cherry picked from commit 7725c03)

Co-authored-by: Jun Komoda <[email protected]>
@bedevere-app

bedevere-app Bot commented Nov 22, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Nov 22, 2024
@bedevere-app

bedevere-app Bot commented Nov 22, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Nov 22, 2024
@junkmd
junkmd deleted the add_com_method_tests branch November 22, 2024 21:27
encukou pushed a commit that referenced this pull request Nov 25, 2024
@miss-islington @junkmd
[3.13] gh-126384: Add tests to verify the behavior of basic COM metho…
f0c47ea
…ds. (GH-126610) (GH-127159)

(cherry picked from commit 7725c03)

Co-authored-by: Jun Komoda <[email protected]>
encukou pushed a commit that referenced this pull request Nov 25, 2024
@miss-islington @junkmd
[3.12] gh-126384: Add tests to verify the behavior of basic COM metho…
f7e587d
…ds. (GH-126610) (GH-127160)

(cherry picked from commit 7725c03)

Co-authored-by: Jun Komoda <[email protected]>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
@junkmd @ebonnal
pythongh-126384: Add tests to verify the behavior of basic COM method…
d133868
…s. (pythonGH-126610)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@encukou encukou encukou approved these changes
@picnixz picnixz picnixz approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir topic-ctypes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@junkmd @encukou @bedevere-bot @picnixz @ZeroIntensity
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.