Skip to content

Commit

Permalink
Apply review comment
Browse files Browse the repository at this point in the history
and fix a couple of Mypy issues
  • Loading branch information
sadra-barikbin committed Dec 15, 2023
1 parent c962339 commit 95f53e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/_pytest/assertion/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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
Expand Down Expand Up @@ -668,9 +669,9 @@ def __init__(
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:
Expand Down
5 changes: 2 additions & 3 deletions src/_pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
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
Expand Down Expand Up @@ -1189,7 +1188,7 @@ def id(self) -> str:


# Used for storing pseudo fixturedefs for direct parametrization.
name2pseudofixturedef_key = StashKey[Dict[str, FixtureDef[Any]]]()
name2pseudofixturedef_key = StashKey[Dict[str, IdentityFixtureDef[Any]]]()


@final
Expand Down Expand Up @@ -1379,7 +1378,7 @@ def parametrize(
if node is None:
name2pseudofixturedef = None
else:
default: Dict[str, FixtureDef[Any]] = {}
default: Dict[str, IdentityFixtureDef[Any]] = {}

Check warning on line 1381 in src/_pytest/python.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/python.py#L1381

Added line #L1381 was not covered by tests
name2pseudofixturedef = node.stash.setdefault(
name2pseudofixturedef_key, default
)
Expand Down
8 changes: 4 additions & 4 deletions testing/python/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4571,8 +4571,8 @@ def test(fixture2):
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):
Expand Down Expand Up @@ -4720,8 +4720,8 @@ def test(fm):
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:
Expand Down

0 comments on commit 95f53e3

Please sign in to comment.