Skip to content

Apply filterwarnings whilst importing plugins#14776

Open
tjkuson wants to merge 1 commit into
pytest-dev:mainfrom
tjkuson:plugin-import-warnings
Open

Apply filterwarnings whilst importing plugins#14776
tjkuson wants to merge 1 commit into
pytest-dev:mainfrom
tjkuson:plugin-import-warnings

Conversation

@tjkuson

@tjkuson tjkuson commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Apply the filterwarnings configuration whilst importing pytest plugins.

I couldn't figure out a non-hacky way to have the filterwarnings apply to pytest plugins imported via the plugins= parameter of pytest.main that didn't involve a large (and possibly breaking) change to how plugins are imported.

Updated the existing test_external_plugins_integrated test as now the warning is consumed and reported via the pytest_warning_recorded hook. Updated the pytest.ini file in the plugin integration tests to ignore the warning related to the usage of CallSpec2 in the pytest-bdd test.

Closes #12697

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 24, 2026
@tjkuson
tjkuson force-pushed the plugin-import-warnings branch from f0d9de4 to 0413f05 Compare July 24, 2026 12:45
@tjkuson
tjkuson force-pushed the plugin-import-warnings branch from 3e9d2c8 to e01fcff Compare July 24, 2026 13:18
@tjkuson
tjkuson marked this pull request as ready for review July 24, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surprisingly, pytest doesn't collect warnings when importing the package for plugins

2 participants