diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 149101e71..b1a644cbf 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -17,6 +17,7 @@ from collections import defaultdict from pathlib import Path from pathlib import PurePath from typing import Callable +from typing import DefaultDict from typing import Dict from typing import IO from typing import Iterable @@ -668,9 +669,9 @@ class AssertionRewriter(ast.NodeVisitor): else: self.enable_assertion_pass_hook = False self.source = source - self.scope: tuple[ast.AST, ...] = () - self.variables_overwrite: defaultdict[ - tuple[ast.AST, ...], Dict[str, str] + self.scope: Tuple[ast.AST, ...] = () + self.variables_overwrite: DefaultDict[ + Tuple[ast.AST, ...], Dict[str, str] ] = defaultdict(dict) def run(self, mod: ast.Module) -> None: diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 8b8923c85..7a6d788d4 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -60,7 +60,6 @@ from _pytest.deprecated import check_ispytest from _pytest.deprecated import INSTANCE_COLLECTOR from _pytest.deprecated import NOSE_SUPPORT_METHOD from _pytest.fixtures import _get_direct_parametrize_args -from _pytest.fixtures import FixtureDef from _pytest.fixtures import FuncFixtureInfo from _pytest.fixtures import get_scope_node from _pytest.fixtures import IdentityFixtureDef @@ -1189,7 +1188,7 @@ class CallSpec2: # Used for storing pseudo fixturedefs for direct parametrization. -name2pseudofixturedef_key = StashKey[Dict[str, FixtureDef[Any]]]() +name2pseudofixturedef_key = StashKey[Dict[str, IdentityFixtureDef[Any]]]() @final @@ -1379,7 +1378,7 @@ class Metafunc: if node is None: name2pseudofixturedef = None else: - default: Dict[str, FixtureDef[Any]] = {} + default: Dict[str, IdentityFixtureDef[Any]] = {} name2pseudofixturedef = node.stash.setdefault( name2pseudofixturedef_key, default ) diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py index 1d0acbac9..93b1454e5 100644 --- a/testing/python/fixtures.py +++ b/testing/python/fixtures.py @@ -4571,8 +4571,8 @@ def test_fixture_info_after_dynamic_parametrize(pytester: Pytester) -> None: assert fixture2 in (4, 5) """ ) - res = pytester.inline_run() - res.assertoutcome(passed=2) + res = pytester.runpytest() + res.assert_outcomes(passed=2) def test_reordering_after_dynamic_parametrize(pytester: Pytester): @@ -4720,8 +4720,8 @@ def test_dont_recompute_dependency_tree_if_no_direct_dynamic_parametrize( assert calls[6].kwargs["parentnode"].nodeid.endswith("test") """ ) - reprec = pytester.inline_run() - reprec.assertoutcome(passed=6) + reprec = pytester.runpytest() + reprec.assert_outcomes(passed=6) def test_deduplicate_names() -> None: