fix: check common name for incompatible plugin#294
Merged
dgozman merged 1 commit intomicrosoft:mainfrom Nov 14, 2025
Merged
Conversation
Contributor
Author
@microsoft-github-policy-service agree [company="JamesYFC"] |
Contributor
Author
|
@microsoft-github-policy-service agree |
dgozman
reviewed
Nov 13, 2025
dgozman
left a comment
There was a problem hiding this comment.
Thank you for the PR, this is fantastic!
I am very sorry that this PR slipped through our triage process, and nobody looked at it. I've only got a minor comment, and would totally understand if you don't have cycles to update this PR anymore.
In any case, thank you for contributing!
| # Check for incompatible async plugin with canonical name | ||
| if pluginmanager.has_plugin(PW_ASYNC_CANONICAL_NAME): | ||
| raise RuntimeError( | ||
| "pytest-playwright and pytest-playwright-asyncio are not compatible. Please use only one of them." |
There was a problem hiding this comment.
nit: use PLUGIN_INCOMPATIBLE_MESSAGE here as well?
a61b1fd to
a84cedf
Compare
Contributor
Author
|
Thanks for the kind reply. I've amended my commit for your viewing pleasure :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently, the plugins check for the full names of the other plugin (
pytest_playwright.pytest_playwrightin async, andpytest_playwright_asyncio.pytest_playwrightin sync) against thePytestPluginManager's name-to-plugindict, in order to error if the other, incompatible, plugin has been loaded.However, in my project (and it seems like this is pretty common), plugins will be registered under the "common" name:
And so this will fail to raise the error, and we will get this one instead which is much less helpful:
This PR does an additional check for the "common" name, and then checks that the plugin itself has the matching canonical name, which should now handle this case.
As far as I can see, I couldn't find a decent way to register a plugin under a different name as part of the
pytestinvocation, and so I haven't added the additional test case.In the given example above though, this now gives us the expected error:
