Revert "Fix type errors after adding types to the py dependency"

This reverts commit 930a158a6a.

Regression test from Bruno Oliveira.
This commit is contained in:
Ran Benita
2020-01-20 23:08:09 +02:00
parent ddfa41b5a7
commit fb99b5c66e
8 changed files with 32 additions and 25 deletions
+4 -4
View File
@@ -82,8 +82,8 @@ class Parser:
self.optparser = self._getparser()
try_argcomplete(self.optparser)
strargs = [str(x) if isinstance(x, py.path.local) else x for x in args]
return self.optparser.parse_args(strargs, namespace=namespace)
args = [str(x) if isinstance(x, py.path.local) else x for x in args]
return self.optparser.parse_args(args, namespace=namespace)
def _getparser(self) -> "MyOptionParser":
from _pytest._argcomplete import filescompleter
@@ -124,8 +124,8 @@ class Parser:
the remaining arguments unknown at this point.
"""
optparser = self._getparser()
strargs = [str(x) if isinstance(x, py.path.local) else x for x in args]
return optparser.parse_known_args(strargs, namespace=namespace)
args = [str(x) if isinstance(x, py.path.local) else x for x in args]
return optparser.parse_known_args(args, namespace=namespace)
def addini(self, name, help, type=None, default=None):
""" register an ini-file option.
+2 -5
View File
@@ -1,9 +1,6 @@
import os
from typing import Any
from typing import Iterable
from typing import List
from typing import Optional
from typing import Tuple
import py
@@ -63,7 +60,7 @@ def getcfg(args, config=None):
return None, None, None
def get_common_ancestor(paths: Iterable[py.path.local]) -> py.path.local:
def get_common_ancestor(paths):
common_ancestor = None
for path in paths:
if not path.exists():
@@ -116,7 +113,7 @@ def determine_setup(
args: List[str],
rootdir_cmd_arg: Optional[str] = None,
config: Optional["Config"] = None,
) -> Tuple[py.path.local, Optional[str], Any]:
):
dirs = get_dirs_from_args(args)
if inifile:
iniconfig = py.iniconfig.IniConfig(inifile)