Skip to content

Commit 9a8f5dd

Browse files
authored
Merge pull request #10007 from nicoddemus/importlib-docs
2 parents a72e8b3 + 6017666 commit 9a8f5dd

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

doc/en/explanation/goodpractices.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,9 @@ This layout prevents a lot of common pitfalls and has many benefits, which are b
173173
`blog post by Ionel Cristian Mărieș <https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure>`_.
174174

175175
.. note::
176-
The new ``--import-mode=importlib`` (see :ref:`import-modes`) doesn't have
176+
The ``--import-mode=importlib`` option (see :ref:`import-modes`) does not have
177177
any of the drawbacks above because ``sys.path`` is not changed when importing
178-
test modules, so users that run
179-
into this issue are strongly encouraged to try it and report if the new option works well for them.
178+
test modules, so users that run into this issue are strongly encouraged to try it.
180179

181180
The ``src`` directory layout is still strongly recommended however.
182181

doc/en/explanation/pythonpath.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,19 @@ these values:
4545

4646
* ``importlib``: new in pytest-6.0, this mode uses :mod:`importlib` to import test modules. This gives full control over the import process, and doesn't require changing :py:data:`sys.path`.
4747

48-
For this reason this doesn't require test module names to be unique, but also makes test
49-
modules non-importable by each other.
48+
For this reason this doesn't require test module names to be unique.
49+
50+
One drawback however is that test modules are non-importable by each other. Also, utility
51+
modules in the tests directories are not automatically importable because the tests directory is no longer
52+
added to :py:data:`sys.path`.
53+
54+
Initially we intended to make ``importlib`` the default in future releases, however it is clear now that
55+
it has its own set of drawbacks so the default will remain ``prepend`` for the foreseeable future.
56+
57+
.. seealso::
58+
59+
The :confval:`pythonpath` configuration variable.
5060

51-
We intend to make ``importlib`` the default in future releases, depending on feedback.
5261

5362
``prepend`` and ``append`` import modes scenarios
5463
-------------------------------------------------

0 commit comments

Comments
 (0)