-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Docs: clarify -p vs PYTEST_PLUGINS plugin loading #14113
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
Docs: clarify -p vs PYTEST_PLUGINS plugin loading #14113
Conversation
|
Thanks! |
Backport to 9.0.x: 💚 backport PR created✅ Backport PR branch: Backported as #14117 🤖 @patchback |
|
No Problem happy to help |
Closes #13388 (cherry picked from commit 6d0aff1) Co-authored-by: Tejas Verma <[email protected]>
|
Sorry it took me so long to comment on this, thanks for taking this up.
However, what difference does the clause
supposed to indicate? Is Speculating, is the difference that |
|
If you think this distinction should be phrased more narrowly or with less emphasis, I’m very happy to adjust the wording and work on it more if the maintainers also feel the same . |
|
The thing is that I don't understand the difference 100% myself, so I'm not confident with my suggestions (note my hedge in calling the above a speculation). .. note::
<they both explicitly control, as before>
:option:`-p` acts on entry-points -- it loads (or disables with `-p
no:<name>`) plugins by looking them up in the list of installed entry
points.
:envvar:`PYTEST_PLUGINS` acts on modules -- it loads the specified modules
from :envvar:`PYTHONPATH`.
Thus, :option:`-p` is usually used by users of the plugins, while
:envvar`:PYTEST_PLUGINS` is usually useful for plugin development (where the
plugin module might not yet be installed on the test system).
<don't double-load>
<examples>What do you think? |
|
Not sure my understanding is correct -- but then, I'm not sure I understand my test case ( |
|
The intent is not to draw a hard architectural line, but to make two things explicit: -p is early, per-invocation control (including blocking), while PYTEST_PLUGINS is explicit module loading during startup. |
|
Again I find myself confused. At the end of the day, what does PYTEST_PLUGINS actually do? And how does -p's earliness affect things?
|
|
Would it help if I shared a couple of minimal test cases you can run locally, when I have some free time to put them together? |
|
Perhaps - that would be appreciated, thanks!
|
|
Hi @hseg — I built a minimal repro and read through the issue you opened. |
|
Hrm. Yeah, the script I posted to Dooopinder/p_dash_proof#2 shows that TBH, I consider this a misfeature, that should actually be solved within Additionally, this testsuite still doesn't manage to distinguish |
|
Sorry for the delay in response, was swamped the past few days. |
|
no issue man in regards to delay and i also think after reading your comment not the test repo will try later that a good discussion i think is required to properly tackle this with the maintainers because again their input would help more |
Summary
This PR clarifies the difference between
-pandPYTEST_PLUGINSin the plugin documentation and fixes an incorrect command example.Details
pytest --disable-plugin-autoload -p NAME,NAME2→ replaced with the correct repeated form
-p NAME -p NAME2-pearly-loads (or disables) a plugin by name or entry point for a single invocationPYTEST_PLUGINSloads plugin modules during startup, commonly used when testing pluginscloses #13388
Changelog: not needed (documentation-only change).