Skip to content

Commit aa077ab

Browse files
authored
Merge pull request #7841 from asottile/py36_todo
py36+: resolve py36 TODOs
2 parents c2a197f + 53b5f64 commit aa077ab

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/_pytest/mark/structures.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import Iterator
99
from typing import List
1010
from typing import Mapping
11+
from typing import MutableMapping
1112
from typing import NamedTuple
1213
from typing import Optional
1314
from typing import Sequence
@@ -94,8 +95,7 @@ def param(
9495
if isinstance(marks, MarkDecorator):
9596
marks = (marks,)
9697
else:
97-
# TODO(py36): Change to collections.abc.Collection.
98-
assert isinstance(marks, (collections.abc.Sequence, set))
98+
assert isinstance(marks, collections.abc.Collection)
9999

100100
if id is not None:
101101
if not isinstance(id, str):
@@ -475,13 +475,12 @@ def test_function():
475475

476476
# See TYPE_CHECKING above.
477477
if TYPE_CHECKING:
478-
# TODO(py36): Change to builtin annotation syntax.
479-
skip = _SkipMarkDecorator(Mark("skip", (), {}))
480-
skipif = _SkipifMarkDecorator(Mark("skipif", (), {}))
481-
xfail = _XfailMarkDecorator(Mark("xfail", (), {}))
482-
parametrize = _ParametrizeMarkDecorator(Mark("parametrize", (), {}))
483-
usefixtures = _UsefixturesMarkDecorator(Mark("usefixtures", (), {}))
484-
filterwarnings = _FilterwarningsMarkDecorator(Mark("filterwarnings", (), {}))
478+
skip: _SkipMarkDecorator
479+
skipif: _SkipifMarkDecorator
480+
xfail: _XfailMarkDecorator
481+
parametrize: _ParametrizeMarkDecorator
482+
usefixtures: _UsefixturesMarkDecorator
483+
filterwarnings: _FilterwarningsMarkDecorator
485484

486485
def __getattr__(self, name: str) -> MarkDecorator:
487486
if name[0] == "_":
@@ -527,9 +526,8 @@ def __getattr__(self, name: str) -> MarkDecorator:
527526
MARK_GEN = MarkGenerator()
528527

529528

530-
# TODO(py36): inherit from typing.MutableMapping[str, Any].
531529
@final
532-
class NodeKeywords(collections.abc.MutableMapping): # type: ignore[type-arg]
530+
class NodeKeywords(MutableMapping[str, Any]):
533531
def __init__(self, node: "Node") -> None:
534532
self.node = node
535533
self.parent = node.parent

testing/test_assertion.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import collections.abc
21
import sys
32
import textwrap
43
from typing import Any
54
from typing import List
5+
from typing import MutableSequence
66
from typing import Optional
77

88
import attr
@@ -637,8 +637,7 @@ def test_frozenzet(self) -> None:
637637

638638
def test_Sequence(self) -> None:
639639
# Test comparing with a Sequence subclass.
640-
# TODO(py36): Inherit from typing.MutableSequence[int].
641-
class TestSequence(collections.abc.MutableSequence): # type: ignore[type-arg]
640+
class TestSequence(MutableSequence[int]):
642641
def __init__(self, iterable):
643642
self.elements = list(iterable)
644643

0 commit comments

Comments
 (0)