Skip to content

Commit 9a6e12c

Browse files
committed
docs: Add a note for package maintainers
Signed-off-by: Dmitry Dygalo <[email protected]>
1 parent a70532b commit 9a6e12c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,30 @@ To run the tests:
242242
243243
For more information, take a look at `our contributing guide <https://github.com/kiwicom/pytest-recording/blob/master/CONTRIBUTING.rst>`_
244244

245+
Test Isolation for Package Maintainers
246+
--------------------------------------
247+
248+
When running pytest-based tests in a packaging environment, globally installed plugins can break test suites by
249+
injecting unexpected hooks or fixtures (e.g. ``pytest-pretty``) that your code isn’t designed for.
250+
251+
To guarantee a clean, reproducible test run:
252+
253+
.. code-block:: console
254+
255+
export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
256+
export PYTEST_PLUGINS=pytest_httpbin.plugin,pytest_mock,pytest_recording.plugin
257+
258+
- **PYTEST_DISABLE_PLUGIN_AUTOLOAD**
259+
Disables loading of any plugins via setuptools entry-points; only those you explicitly list
260+
will be activated.
261+
262+
- **PYTEST_PLUGINS**
263+
Comma-separated list of plugin modules pytest should load (the core plugin manager still
264+
discovers builtin plugins and `conftest.py`).
265+
266+
Include these exports in your package’s build or CI script so that system-wide pytest plugins
267+
(e.g. linting, formatting, or unrelated test helpers) cannot interfere with your tests.
268+
245269
Python support
246270
--------------
247271

0 commit comments

Comments
 (0)