From 61301d934e5e08620c5f7be82384bc07d3d51ea9 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sun, 8 Jul 2018 16:57:18 -0700 Subject: [PATCH] Remove some extraneous `# noqa` comments This was partially automated with https://github.com/asottile/yesqa _with a few caveats_: - it was run under python2 (chosen arbitrarily, when run under python3 other things were changed) - I used `git checkout -p` to revert the removal of `noqa` comments from `cmp()` lines. --- src/_pytest/compat.py | 4 ++-- src/_pytest/config/__init__.py | 2 +- testing/test_assertrewrite.py | 2 +- testing/test_pytester.py | 5 +---- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 3ca27fe60..dab09c9d5 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -41,8 +41,8 @@ PY36 = sys.version_info[:2] >= (3, 6) MODULE_NOT_FOUND_ERROR = "ModuleNotFoundError" if PY36 else "ImportError" if _PY3: - from collections.abc import MutableMapping as MappingMixin # noqa - from collections.abc import Mapping, Sequence # noqa + from collections.abc import MutableMapping as MappingMixin + from collections.abc import Mapping, Sequence else: # those raise DeprecationWarnings in Python >=3.7 from collections import MutableMapping as MappingMixin # noqa diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 7e7f3b6d2..421d124e9 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -71,7 +71,7 @@ def main(args=None, plugins=None): return 4 -class cmdline(object): # NOQA compatibility namespace +class cmdline(object): # compatibility namespace main = staticmethod(main) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 2640beb63..274b1ac53 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -941,7 +941,7 @@ class TestAssertionRewriteHookDetails(object): e = IOError() e.errno = 10 raise e - yield # noqa + yield monkeypatch.setattr(atomicwrites, "atomic_write", atomic_write_failed) assert not _write_pyc(state, [1], source_path.stat(), pycpath) diff --git a/testing/test_pytester.py b/testing/test_pytester.py index 9776a8659..86dc35796 100644 --- a/testing/test_pytester.py +++ b/testing/test_pytester.py @@ -364,10 +364,7 @@ class TestSysPathsSnapshot(object): original = list(sys_path) original_other = list(getattr(sys, other_path_type)) snapshot = SysPathsSnapshot() - transformation = { - "source": (0, 1, 2, 3, 4, 5), - "target": (6, 2, 9, 7, 5, 8), - } # noqa: E201 + transformation = {"source": (0, 1, 2, 3, 4, 5), "target": (6, 2, 9, 7, 5, 8)} assert sys_path == [self.path(x) for x in transformation["source"]] sys_path[1] = self.path(6) sys_path[3] = self.path(7)