playwright-pytest icon indicating copy to clipboard operation
playwright-pytest copied to clipboard

feat: add compatibility check between pytest-playwright and pytest-playwright-asyncio

Open mecampbellsoup opened this issue 9 months ago • 1 comments

Related to https://github.com/microsoft/playwright-pytest/issues/278 (and specifically https://github.com/microsoft/playwright-pytest/issues/278#issuecomment-2941493248).

mecampbellsoup avatar Jun 05 '25 15:06 mecampbellsoup

@mxschmitt here's a first pass!

mecampbellsoup avatar Jun 05 '25 15:06 mecampbellsoup

@mxschmitt Thanks for the suggestion! I've implemented the compatibility check in pytest_addoption as you recommended.

Key Improvements

Earlier detection - Check now occurs during plugin loading, not fixture execution
Better user experience - Clear error messages instead of confusing "option names already added" errors
Type safety - Added proper type annotations (Parser, PytestPluginManager)
Code quality - All pre-commit hooks pass (black, mypy, flake8)

The implementation detects the incompatible plugin using pluginmanager.hasplugin() and raises a clear RuntimeError before any option registration conflicts can occur. This provides immediate, actionable feedback to users who accidentally install both plugins.

Ready for review! 🚀

mecampbellsoup avatar Aug 01 '25 16:08 mecampbellsoup

Thanks @mxschmitt and @Skn0tt!

mecampbellsoup avatar Aug 04 '25 13:08 mecampbellsoup