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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate pytest_plugins in non-toplevel conftests #3084

Closed
nicoddemus opened this Issue Jan 5, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@nicoddemus
Member

nicoddemus commented Jan 5, 2018

We must deprecate this somehow before being able to remove it.

After this issue is merged, we should create a task for removal associated with a proper milestone.

@pytestbot

This comment has been minimized.

pytestbot commented Jan 5, 2018

GitMate.io thinks the contributor most likely able to help you is @RonnyPfannschmidt.

@brianmaissy

This comment has been minimized.

Contributor

brianmaissy commented Jan 25, 2018

I'll take this.

Just so I understand the full picture, why do we want to deprecate this? Are there implementation considerations, behavioral considerations, or just for good practice for staying organized?

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Jan 26, 2018

@brianmaissy pytest_plugins always has global effects, so plug-ins added somewhere in a directory tree leak to the complete project, which is undesirable and source of hard to comprehend bugs

@brianmaissy

This comment has been minimized.

Contributor

brianmaissy commented Jan 27, 2018

ah i see, makes sense

@brianmaissy

This comment has been minimized.

Contributor

brianmaissy commented Feb 16, 2018

@nicoddemus @RonnyPfannschmidt While trying to test this deprecation I ran into a problem. Since DeprecationWarnings are ignored by default, no user will ever see this warning, unless we don't use an actual DeprecationWarning. The warning filters on the command line and in the ini files don't take effect during the initialization stages of importing conftests, so even if a user was aware of this and wanted to receive DeprecationWarnings from pytest they wouldn't have a way. I assume you've run into this problem before, but I wasn't able to find an example in the code. Am I missing something?

Am I supposed to use the _warn method of the PytestPluginManager? I didn't understand the different codes used there (I1, I2).

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Feb 16, 2018

@brianmaissy the starting point is declaring a RemovedInPytest4 wanring instance in _pytest.deprecated

@brianmaissy

This comment has been minimized.

Contributor

brianmaissy commented Feb 16, 2018

That I understand, but if I raise it in config.py while importing conftests, it will just get ignored by the python warnings filter

@brianmaissy

This comment has been minimized.

Contributor

brianmaissy commented Feb 16, 2018

I guess they could change the warnings filter in the top-level conftest. Still, it seems like deprecation warnings should be more visible

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