Remove no longer needed noqa's

This commit is contained in:
Ran Benita 2020-04-24 22:24:40 +03:00
parent 59a12e9ab3
commit 23c9856857
11 changed files with 18 additions and 18 deletions

View File

@ -44,7 +44,7 @@ from _pytest.compat import TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Type from typing import Type
from typing_extensions import Literal from typing_extensions import Literal
from weakref import ReferenceType # noqa: F401 from weakref import ReferenceType
_TracebackStyle = Literal["long", "short", "line", "no", "native"] _TracebackStyle = Literal["long", "short", "line", "no", "native"]

View File

@ -669,7 +669,7 @@ class SysCaptureBinary:
class SysCapture(SysCaptureBinary): class SysCapture(SysCaptureBinary):
EMPTY_BUFFER = "" # type: ignore[assignment] # noqa: F821 EMPTY_BUFFER = "" # type: ignore[assignment]
def snap(self): def snap(self):
res = self.tmpfile.getvalue() res = self.tmpfile.getvalue()

View File

@ -32,7 +32,7 @@ else:
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Type # noqa: F401 (used in type string) from typing import Type
_T = TypeVar("_T") _T = TypeVar("_T")

View File

@ -21,7 +21,7 @@ from _pytest.config.exceptions import UsageError
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import NoReturn from typing import NoReturn
from typing_extensions import Literal # noqa: F401 from typing_extensions import Literal
FILE_OR_DIR = "file_or_dir" FILE_OR_DIR = "file_or_dir"

View File

@ -12,7 +12,7 @@ from _pytest.compat import TYPE_CHECKING
from _pytest.outcomes import fail from _pytest.outcomes import fail
if TYPE_CHECKING: if TYPE_CHECKING:
from . import Config # noqa: F401 from . import Config
def exists(path, ignore=OSError): def exists(path, ignore=OSError):

View File

@ -338,7 +338,7 @@ class LogCaptureFixture:
""" """
:rtype: LogCaptureHandler :rtype: LogCaptureHandler
""" """
return self._item.catch_log_handler # type: ignore[no-any-return] # noqa: F723 return self._item.catch_log_handler # type: ignore[no-any-return]
def get_records(self, when: str) -> List[logging.LogRecord]: def get_records(self, when: str) -> List[logging.LogRecord]:
""" """
@ -354,7 +354,7 @@ class LogCaptureFixture:
""" """
handler = self._item.catch_log_handlers.get(when) handler = self._item.catch_log_handlers.get(when)
if handler: if handler:
return handler.records # type: ignore[no-any-return] # noqa: F723 return handler.records # type: ignore[no-any-return]
else: else:
return [] return []
@ -640,15 +640,15 @@ class LoggingPlugin:
return return
if not hasattr(item, "catch_log_handlers"): if not hasattr(item, "catch_log_handlers"):
item.catch_log_handlers = {} # type: ignore[attr-defined] # noqa: F821 item.catch_log_handlers = {} # type: ignore[attr-defined]
item.catch_log_handlers[when] = log_handler # type: ignore[attr-defined] # noqa: F821 item.catch_log_handlers[when] = log_handler # type: ignore[attr-defined]
item.catch_log_handler = log_handler # type: ignore[attr-defined] # noqa: F821 item.catch_log_handler = log_handler # type: ignore[attr-defined]
try: try:
yield # run test yield # run test
finally: finally:
if when == "teardown": if when == "teardown":
del item.catch_log_handler # type: ignore[attr-defined] # noqa: F821 del item.catch_log_handler # type: ignore[attr-defined]
del item.catch_log_handlers # type: ignore[attr-defined] # noqa: F821 del item.catch_log_handlers # type: ignore[attr-defined]
if self.print_logs: if self.print_logs:
# Add a captured log section to the report. # Add a captured log section to the report.

View File

@ -12,7 +12,7 @@ from _pytest.mark.expression import evaluate
from _pytest.mark.expression import ParseError from _pytest.mark.expression import ParseError
if TYPE_CHECKING: if TYPE_CHECKING:
from _pytest.nodes import Item # noqa: F401 (used in type string) from _pytest.nodes import Item
@attr.s @attr.s

View File

@ -33,7 +33,7 @@ from _pytest.store import Store
if TYPE_CHECKING: if TYPE_CHECKING:
# Imported here due to circular import. # Imported here due to circular import.
from _pytest.main import Session # noqa: F401 from _pytest.main import Session
SEP = "/" SEP = "/"

View File

@ -15,7 +15,7 @@ TYPE_CHECKING = False # avoid circular import through compat
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import NoReturn from typing import NoReturn
from typing import Type # noqa: F401 (Used in string type annotation.) from typing import Type # noqa: F401 (used in type string)
from typing_extensions import Protocol from typing_extensions import Protocol
else: else:
# typing.Protocol is only available starting from Python 3.8. It is also # typing.Protocol is only available starting from Python 3.8. It is also

View File

@ -136,7 +136,7 @@ def pytest_cmdline_main(config):
def pytest_generate_tests(metafunc: "Metafunc") -> None: def pytest_generate_tests(metafunc: "Metafunc") -> None:
for marker in metafunc.definition.iter_markers(name="parametrize"): for marker in metafunc.definition.iter_markers(name="parametrize"):
# TODO: Fix this type-ignore (overlapping kwargs). # TODO: Fix this type-ignore (overlapping kwargs).
metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker) # type: ignore[misc] # noqa: F821 metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker) # type: ignore[misc]
def pytest_configure(config): def pytest_configure(config):
@ -1013,7 +1013,7 @@ class Metafunc:
func_name: str, func_name: str,
) -> List[Union[None, str]]: ) -> List[Union[None, str]]:
try: try:
num_ids = len(ids) # type: ignore[arg-type] # noqa: F821 num_ids = len(ids) # type: ignore[arg-type]
except TypeError: except TypeError:
try: try:
iter(ids) iter(ids)

View File

@ -27,7 +27,7 @@ from _pytest.compat import TYPE_CHECKING
from _pytest.outcomes import fail from _pytest.outcomes import fail
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Type # noqa: F401 (used in type string) from typing import Type
BASE_TYPE = (type, STRING_TYPES) BASE_TYPE = (type, STRING_TYPES)