Apply review comment

and fix a couple of Mypy issues
This commit is contained in:
Sadra Barikbin 2023-12-15 21:40:05 +03:30
parent c96233919f
commit 95f53e32d7
3 changed files with 10 additions and 10 deletions

View File

@ -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:

View File

@ -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
)

View File

@ -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: