You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New flag: :ref:`--disable-plugin-autoload <disable_plugin_autoload>` which works as an alternative to :envvar:`PYTEST_DISABLE_PLUGIN_AUTOLOAD` when setting environment variables is inconvenient; and allows setting it in config files with :confval:`addopts`.
Copy file name to clipboardexpand all lines: doc/en/how-to/plugins.rst
+26-1
Original file line number
Diff line number
Diff line change
@@ -133,4 +133,29 @@ CI server), you can set ``PYTEST_ADDOPTS`` environment variable to
133
133
134
134
See :ref:`findpluginname` for how to obtain the name of a plugin.
135
135
136
-
.. _`builtin plugins`:
136
+
.. _`disable_plugin_autoload`:
137
+
138
+
Disabling plugins from autoloading
139
+
----------------------------------
140
+
141
+
If you want to disable plugins from loading automatically, instead of requiring you to
142
+
manually specify each plugin with ``-p`` or :envvar:`PYTEST_PLUGINS`, you can use ``--disable-plugin-autoload`` or :envvar:`PYTEST_DISABLE_PLUGIN_AUTOLOAD`.
143
+
144
+
.. code-block:: bash
145
+
146
+
export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
147
+
export PYTEST_PLUGINS=NAME,NAME2
148
+
pytest
149
+
150
+
.. code-block:: bash
151
+
152
+
pytest --disable-plugin-autoload -p NAME,NAME2
153
+
154
+
.. code-block:: ini
155
+
156
+
[pytest]
157
+
addopts = --disable-plugin-autoload -p NAME,NAME2
158
+
159
+
.. versionadded:: 8.4
160
+
161
+
The ``--disable-plugin-autoload`` command-line flag.
0 commit comments