Skip to content

Commit 95f53e3

Browse files
Apply review comment
and fix a couple of Mypy issues
1 parent c962339 commit 95f53e3

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/_pytest/assertion/rewrite.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pathlib import Path
1818
from pathlib import PurePath
1919
from typing import Callable
20+
from typing import DefaultDict
2021
from typing import Dict
2122
from typing import IO
2223
from typing import Iterable
@@ -668,9 +669,9 @@ def __init__(
668669
else:
669670
self.enable_assertion_pass_hook = False
670671
self.source = source
671-
self.scope: tuple[ast.AST, ...] = ()
672-
self.variables_overwrite: defaultdict[
673-
tuple[ast.AST, ...], Dict[str, str]
672+
self.scope: Tuple[ast.AST, ...] = ()
673+
self.variables_overwrite: DefaultDict[
674+
Tuple[ast.AST, ...], Dict[str, str]
674675
] = defaultdict(dict)
675676

676677
def run(self, mod: ast.Module) -> None:

src/_pytest/python.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
from _pytest.deprecated import INSTANCE_COLLECTOR
6161
from _pytest.deprecated import NOSE_SUPPORT_METHOD
6262
from _pytest.fixtures import _get_direct_parametrize_args
63-
from _pytest.fixtures import FixtureDef
6463
from _pytest.fixtures import FuncFixtureInfo
6564
from _pytest.fixtures import get_scope_node
6665
from _pytest.fixtures import IdentityFixtureDef
@@ -1189,7 +1188,7 @@ def id(self) -> str:
11891188

11901189

11911190
# Used for storing pseudo fixturedefs for direct parametrization.
1192-
name2pseudofixturedef_key = StashKey[Dict[str, FixtureDef[Any]]]()
1191+
name2pseudofixturedef_key = StashKey[Dict[str, IdentityFixtureDef[Any]]]()
11931192

11941193

11951194
@final
@@ -1379,7 +1378,7 @@ def parametrize(
13791378
if node is None:
13801379
name2pseudofixturedef = None
13811380
else:
1382-
default: Dict[str, FixtureDef[Any]] = {}
1381+
default: Dict[str, IdentityFixtureDef[Any]] = {}
13831382
name2pseudofixturedef = node.stash.setdefault(
13841383
name2pseudofixturedef_key, default
13851384
)

testing/python/fixtures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4571,8 +4571,8 @@ def test(fixture2):
45714571
assert fixture2 in (4, 5)
45724572
"""
45734573
)
4574-
res = pytester.inline_run()
4575-
res.assertoutcome(passed=2)
4574+
res = pytester.runpytest()
4575+
res.assert_outcomes(passed=2)
45764576

45774577

45784578
def test_reordering_after_dynamic_parametrize(pytester: Pytester):
@@ -4720,8 +4720,8 @@ def test(fm):
47204720
assert calls[6].kwargs["parentnode"].nodeid.endswith("test")
47214721
"""
47224722
)
4723-
reprec = pytester.inline_run()
4724-
reprec.assertoutcome(passed=6)
4723+
reprec = pytester.runpytest()
4724+
reprec.assert_outcomes(passed=6)
47254725

47264726

47274727
def test_deduplicate_names() -> None:

0 commit comments

Comments
 (0)