From d1534181c0bd165f354179d1ac131d874b71a81b Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 24 Apr 2020 21:51:32 +0300 Subject: [PATCH] pre-commit: upgrade flake8 3.7.7 -> 3.8.1 New errors: testing/test_setupplan.py:104:15: E741 ambiguous variable name 'l' testing/test_setupplan.py:107:15: E741 ambiguous variable name 'l' extra/get_issues.py:48:29: E741 ambiguous variable name 'l' testing/test_error_diffs.py:270:32: E741 ambiguous variable name 'l' Not so sure about it but easier to just fix. But more importantly, is a large amount of typing-related issues there were fixed which necessitated noqa's which can now be removed. --- .pre-commit-config.yaml | 4 ++-- extra/get_issues.py | 2 +- testing/test_error_diffs.py | 2 +- testing/test_setupplan.py | 8 ++++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fd909dd5d..81e30ecc1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,11 +21,11 @@ repos: exclude: _pytest/debugging.py language_version: python3 - repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.7 + rev: 3.8.1 hooks: - id: flake8 language_version: python3 - additional_dependencies: [flake8-typing-imports==1.3.0] + additional_dependencies: [flake8-typing-imports==1.9.0] - repo: https://github.com/asottile/reorder_python_imports rev: v1.4.0 hooks: diff --git a/extra/get_issues.py b/extra/get_issues.py index 9407aeded..c264b2644 100644 --- a/extra/get_issues.py +++ b/extra/get_issues.py @@ -45,7 +45,7 @@ def main(args): def _get_kind(issue): - labels = [l["name"] for l in issue["labels"]] + labels = [label["name"] for label in issue["labels"]] for key in ("bug", "enhancement", "proposal"): if key in labels: return key diff --git a/testing/test_error_diffs.py b/testing/test_error_diffs.py index c7198bde0..473c62a75 100644 --- a/testing/test_error_diffs.py +++ b/testing/test_error_diffs.py @@ -267,7 +267,7 @@ if sys.version_info[:2] >= (3, 7): @pytest.mark.parametrize("code, expected", TESTCASES) def test_error_diff(code, expected, testdir): - expected = [l.lstrip() for l in expected.splitlines()] + expected = [line.lstrip() for line in expected.splitlines()] p = testdir.makepyfile(code) result = testdir.runpytest(p, "-vv") result.stdout.fnmatch_lines(expected) diff --git a/testing/test_setupplan.py b/testing/test_setupplan.py index a44474dd1..64b464b32 100644 --- a/testing/test_setupplan.py +++ b/testing/test_setupplan.py @@ -101,10 +101,14 @@ def test_show_multi_test_fixture_setup_and_teardown_same_as_setup_show(testdir): # the number and text of these lines should be identical plan_lines = [ - l for l in plan_result.stdout.lines if "SETUP" in l or "TEARDOWN" in l + line + for line in plan_result.stdout.lines + if "SETUP" in line or "TEARDOWN" in line ] show_lines = [ - l for l in show_result.stdout.lines if "SETUP" in l or "TEARDOWN" in l + line + for line in show_result.stdout.lines + if "SETUP" in line or "TEARDOWN" in line ] assert plan_lines == show_lines