Skip to content

Commit 1981cd8

Browse files
refactor: extract the parametrization core into _pytest.parametrize
Move IdMaker, CallSpec and _ascii_escaped_by_config out of python.py into a new module, together with the long-str id strategy literals they own. python.py imports them back, so _pytest.python.CallSpec and the CallSpec2 alias keep resolving as before. Pure move, no behaviour change. The two CollectError call sites go through a small _collect_error() helper which imports nodes lazily, so nodes stays free to import this module later.
1 parent f3f4e68 commit 1981cd8

6 files changed

Lines changed: 431 additions & 375 deletions

File tree

‎changelog/14856.misc.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Moved the parametrization core out of ``_pytest.python`` into the new
2+
``_pytest.parametrize`` module: ``CallSpec``, ``IdMaker`` and the id strategy
3+
literals. ``_pytest.python`` re-exports them, so ``_pytest.python.CallSpec`` and
4+
the deprecated ``CallSpec2`` alias keep working.

‎src/_pytest/fixtures.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484

8585

8686
if TYPE_CHECKING:
87-
from _pytest.python import CallSpec
87+
from _pytest.parametrize import CallSpec
8888
from _pytest.python import Function
8989
from _pytest.python import Metafunc
9090
from _pytest.reports import CollectReport

0 commit comments

Comments
 (0)