From 0b41b79dcb985f2fbb56772ddedcfc6f0e210748 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 21 Aug 2020 10:47:29 +0300 Subject: [PATCH] main: better solution to a type ignore --- src/_pytest/main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/_pytest/main.py b/src/_pytest/main.py index f71ef86de..f31defe67 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -597,10 +597,11 @@ class Session(nodes.FSCollector): self._notfound = [] # type: List[Tuple[str, NoMatch]] self._initial_parts = [] # type: List[Tuple[py.path.local, List[str]]] - self.items = items = [] # type: List[nodes.Item] + self.items = [] # type: List[nodes.Item] hook = self.config.hook + items = self.items # type: Sequence[Union[nodes.Item, nodes.Collector]] try: initialpaths = [] # type: List[py.path.local] for arg in args: @@ -620,9 +621,7 @@ class Session(nodes.FSCollector): errors.append("not found: {}\n{}".format(arg, line)) raise UsageError(*errors) if not genitems: - # Type ignored because genitems=False is only used by tests. We don't - # want to change the type of `session.items` for this case. - items = rep.result # type: ignore[assignment] + items = rep.result else: if rep.passed: for node in rep.result: