mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-09 14:24:17 +00:00
require python 3.8.1+
This commit is contained in:
parent
16c371d41c
commit
aa002ee4ed
12 changed files with 70 additions and 94 deletions
18
.github/workflows/main.yml
vendored
18
.github/workflows/main.yml
vendored
|
|
@ -13,10 +13,7 @@ jobs:
|
||||||
include:
|
include:
|
||||||
# linux
|
# linux
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
python: pypy-3.7
|
python: pypy-3.8
|
||||||
toxenv: py
|
|
||||||
- os: ubuntu-latest
|
|
||||||
python: 3.7
|
|
||||||
toxenv: py
|
toxenv: py
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
python: 3.8
|
python: 3.8
|
||||||
|
|
@ -25,21 +22,24 @@ jobs:
|
||||||
python: 3.9
|
python: 3.9
|
||||||
toxenv: py
|
toxenv: py
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
python: '3.10.0-alpha - 3.10.999'
|
python: '3.10'
|
||||||
|
toxenv: py
|
||||||
|
- os: ubuntu-latest
|
||||||
|
python: '3.11'
|
||||||
toxenv: py
|
toxenv: py
|
||||||
# windows
|
# windows
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python: 3.7
|
python: 3.8
|
||||||
toxenv: py
|
toxenv: py
|
||||||
# misc
|
# misc
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
python: 3.9
|
python: '3.10'
|
||||||
toxenv: docs
|
toxenv: docs
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
python: 3.9
|
python: '3.10'
|
||||||
toxenv: linters
|
toxenv: linters
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
python: 3.9
|
python: '3.10'
|
||||||
toxenv: dogfood
|
toxenv: dogfood
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,14 @@ repos:
|
||||||
- id: reorder-python-imports
|
- id: reorder-python-imports
|
||||||
args: [
|
args: [
|
||||||
--application-directories, '.:src',
|
--application-directories, '.:src',
|
||||||
--py37-plus,
|
--py38-plus,
|
||||||
--add-import, 'from __future__ import annotations',
|
--add-import, 'from __future__ import annotations',
|
||||||
]
|
]
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v3.2.2
|
rev: v3.2.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: [--py37-plus]
|
args: [--py38-plus]
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 22.10.0
|
rev: 22.10.0
|
||||||
hooks:
|
hooks:
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,6 @@ classifiers =
|
||||||
Programming Language :: Python
|
Programming Language :: Python
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3 :: Only
|
Programming Language :: Python :: 3 :: Only
|
||||||
Programming Language :: Python :: 3.7
|
|
||||||
Programming Language :: Python :: 3.8
|
|
||||||
Programming Language :: Python :: 3.9
|
|
||||||
Programming Language :: Python :: 3.10
|
|
||||||
Programming Language :: Python :: Implementation :: CPython
|
Programming Language :: Python :: Implementation :: CPython
|
||||||
Programming Language :: Python :: Implementation :: PyPy
|
Programming Language :: Python :: Implementation :: PyPy
|
||||||
Topic :: Software Development :: Libraries :: Python Modules
|
Topic :: Software Development :: Libraries :: Python Modules
|
||||||
|
|
@ -41,8 +37,8 @@ install_requires =
|
||||||
mccabe>=0.7.0,<0.8.0
|
mccabe>=0.7.0,<0.8.0
|
||||||
pycodestyle>=2.9.0,<2.10.0
|
pycodestyle>=2.9.0,<2.10.0
|
||||||
pyflakes>=2.5.0,<2.6.0
|
pyflakes>=2.5.0,<2.6.0
|
||||||
importlib-metadata>=1.1.0,<4.3;python_version<"3.8"
|
# 3.8.0's importlib.metadata is broken
|
||||||
python_requires = >=3.7
|
python_requires = >=3.8.1
|
||||||
|
|
||||||
[options.packages.find]
|
[options.packages.find]
|
||||||
where = src
|
where = src
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
"""Expose backports in a single place."""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 8): # pragma: no cover (PY38+)
|
|
||||||
import importlib.metadata as importlib_metadata
|
|
||||||
else: # pragma: no cover (<PY38)
|
|
||||||
import importlib_metadata
|
|
||||||
|
|
||||||
if sys.version_info[:3] == (3, 8, 0):
|
|
||||||
# backported from importlib.metadata in 3.8.1
|
|
||||||
importlib_metadata.EntryPoint.__reduce__ = lambda self: ( # type: ignore
|
|
||||||
type(self),
|
|
||||||
(self.name, self.value, self.group), # type: ignore
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = ("importlib_metadata",)
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
|
import importlib.metadata
|
||||||
import inspect
|
import inspect
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
|
|
@ -12,7 +13,6 @@ from typing import Iterable
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
|
|
||||||
from flake8 import utils
|
from flake8 import utils
|
||||||
from flake8._compat import importlib_metadata
|
|
||||||
from flake8.defaults import VALID_CODE_PREFIX
|
from flake8.defaults import VALID_CODE_PREFIX
|
||||||
from flake8.exceptions import ExecutionError
|
from flake8.exceptions import ExecutionError
|
||||||
from flake8.exceptions import FailedToLoadPlugin
|
from flake8.exceptions import FailedToLoadPlugin
|
||||||
|
|
@ -32,7 +32,7 @@ class Plugin(NamedTuple):
|
||||||
|
|
||||||
package: str
|
package: str
|
||||||
version: str
|
version: str
|
||||||
entry_point: importlib_metadata.EntryPoint
|
entry_point: importlib.metadata.EntryPoint
|
||||||
|
|
||||||
|
|
||||||
class LoadedPlugin(NamedTuple):
|
class LoadedPlugin(NamedTuple):
|
||||||
|
|
@ -148,12 +148,12 @@ def parse_plugin_options(
|
||||||
|
|
||||||
|
|
||||||
def _flake8_plugins(
|
def _flake8_plugins(
|
||||||
eps: Iterable[importlib_metadata.EntryPoint],
|
eps: Iterable[importlib.metadata.EntryPoint],
|
||||||
name: str,
|
name: str,
|
||||||
version: str,
|
version: str,
|
||||||
) -> Generator[Plugin, None, None]:
|
) -> Generator[Plugin, None, None]:
|
||||||
pyflakes_meta = importlib_metadata.distribution("pyflakes").metadata
|
pyflakes_meta = importlib.metadata.distribution("pyflakes").metadata
|
||||||
pycodestyle_meta = importlib_metadata.distribution("pycodestyle").metadata
|
pycodestyle_meta = importlib.metadata.distribution("pycodestyle").metadata
|
||||||
|
|
||||||
for ep in eps:
|
for ep in eps:
|
||||||
if ep.group not in FLAKE8_GROUPS:
|
if ep.group not in FLAKE8_GROUPS:
|
||||||
|
|
@ -176,7 +176,7 @@ def _flake8_plugins(
|
||||||
def _find_importlib_plugins() -> Generator[Plugin, None, None]:
|
def _find_importlib_plugins() -> Generator[Plugin, None, None]:
|
||||||
# some misconfigured pythons (RHEL) have things on `sys.path` twice
|
# some misconfigured pythons (RHEL) have things on `sys.path` twice
|
||||||
seen = set()
|
seen = set()
|
||||||
for dist in importlib_metadata.distributions():
|
for dist in importlib.metadata.distributions():
|
||||||
# assigned to prevent continual reparsing
|
# assigned to prevent continual reparsing
|
||||||
eps = dist.entry_points
|
eps = dist.entry_points
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@ def _find_local_plugins(
|
||||||
):
|
):
|
||||||
name, _, entry_str = plugin_s.partition("=")
|
name, _, entry_str = plugin_s.partition("=")
|
||||||
name, entry_str = name.strip(), entry_str.strip()
|
name, entry_str = name.strip(), entry_str.strip()
|
||||||
ep = importlib_metadata.EntryPoint(name, entry_str, group)
|
ep = importlib.metadata.EntryPoint(name, entry_str, group)
|
||||||
yield Plugin("local", "local", ep)
|
yield Plugin("local", "local", ep)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
"""Integration tests for the checker submodule."""
|
"""Integration tests for the checker submodule."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import importlib.metadata
|
||||||
import sys
|
import sys
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from flake8 import checker
|
from flake8 import checker
|
||||||
from flake8._compat import importlib_metadata
|
|
||||||
from flake8.plugins import finder
|
from flake8.plugins import finder
|
||||||
from flake8.processor import FileProcessor
|
from flake8.processor import FileProcessor
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ def mock_file_checker_with_plugin(plugin_target):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake-package",
|
"flake-package",
|
||||||
"9001",
|
"9001",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"Q",
|
"Q",
|
||||||
f"{plugin_target.__module__}:{plugin_target.__name__}",
|
f"{plugin_target.__module__}:{plugin_target.__name__}",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
|
||||||
|
|
@ -170,8 +170,6 @@ def test_tokenization_error_but_not_syntax_error(tmpdir, capsys):
|
||||||
|
|
||||||
if hasattr(sys, "pypy_version_info"): # pragma: no cover (pypy)
|
if hasattr(sys, "pypy_version_info"): # pragma: no cover (pypy)
|
||||||
expected = "t.py:2:1: E999 SyntaxError: end of file (EOF) in multi-line statement\n" # noqa: E501
|
expected = "t.py:2:1: E999 SyntaxError: end of file (EOF) in multi-line statement\n" # noqa: E501
|
||||||
elif sys.version_info < (3, 8): # pragma: no cover (<cp38)
|
|
||||||
expected = "t.py:2:1: E902 TokenError: EOF in multi-line statement\n"
|
|
||||||
elif sys.version_info < (3, 10): # pragma: no cover (cp38+)
|
elif sys.version_info < (3, 10): # pragma: no cover (cp38+)
|
||||||
expected = "t.py:1:8: E999 SyntaxError: unexpected EOF while parsing\n"
|
expected = "t.py:1:8: E999 SyntaxError: unexpected EOF while parsing\n"
|
||||||
else: # pragma: no cover (cp310+)
|
else: # pragma: no cover (cp310+)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
|
import importlib.metadata
|
||||||
import sys
|
import sys
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from flake8._compat import importlib_metadata
|
|
||||||
from flake8.exceptions import ExecutionError
|
from flake8.exceptions import ExecutionError
|
||||||
from flake8.exceptions import FailedToLoadPlugin
|
from flake8.exceptions import FailedToLoadPlugin
|
||||||
from flake8.plugins import finder
|
from flake8.plugins import finder
|
||||||
|
|
@ -14,7 +14,7 @@ from flake8.plugins.pyflakes import FlakesChecker
|
||||||
|
|
||||||
|
|
||||||
def _ep(name="X", value="dne:dne", group="flake8.extension"):
|
def _ep(name="X", value="dne:dne", group="flake8.extension"):
|
||||||
return importlib_metadata.EntryPoint(name, value, group)
|
return importlib.metadata.EntryPoint(name, value, group)
|
||||||
|
|
||||||
|
|
||||||
def _plugin(package="local", version="local", ep=None):
|
def _plugin(package="local", version="local", ep=None):
|
||||||
|
|
@ -91,7 +91,7 @@ Version: 9000.1.0
|
||||||
d = tmp_path.joinpath("pyflakes.dist-info")
|
d = tmp_path.joinpath("pyflakes.dist-info")
|
||||||
d.mkdir()
|
d.mkdir()
|
||||||
d.joinpath("METADATA").write_text(metadata)
|
d.joinpath("METADATA").write_text(metadata)
|
||||||
return importlib_metadata.PathDistribution(d)
|
return importlib.metadata.PathDistribution(d)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
@ -104,7 +104,7 @@ Version: 9000.2.0
|
||||||
d = tmp_path.joinpath("pycodestyle.dist-info")
|
d = tmp_path.joinpath("pycodestyle.dist-info")
|
||||||
d.mkdir()
|
d.mkdir()
|
||||||
d.joinpath("METADATA").write_text(metadata)
|
d.joinpath("METADATA").write_text(metadata)
|
||||||
return importlib_metadata.PathDistribution(d)
|
return importlib.metadata.PathDistribution(d)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
@ -131,7 +131,7 @@ pylint = flake8.formatting.default:Pylint
|
||||||
d.mkdir()
|
d.mkdir()
|
||||||
d.joinpath("METADATA").write_text(metadata)
|
d.joinpath("METADATA").write_text(metadata)
|
||||||
d.joinpath("entry_points.txt").write_text(entry_points)
|
d.joinpath("entry_points.txt").write_text(entry_points)
|
||||||
return importlib_metadata.PathDistribution(d)
|
return importlib.metadata.PathDistribution(d)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
@ -153,13 +153,13 @@ foo = flake8_foo:Formatter
|
||||||
d.mkdir()
|
d.mkdir()
|
||||||
d.joinpath("METADATA").write_text(metadata)
|
d.joinpath("METADATA").write_text(metadata)
|
||||||
d.joinpath("entry_points.txt").write_text(eps)
|
d.joinpath("entry_points.txt").write_text(eps)
|
||||||
return importlib_metadata.PathDistribution(d)
|
return importlib.metadata.PathDistribution(d)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_distribution(pyflakes_dist, pycodestyle_dist):
|
def mock_distribution(pyflakes_dist, pycodestyle_dist):
|
||||||
dists = {"pyflakes": pyflakes_dist, "pycodestyle": pycodestyle_dist}
|
dists = {"pyflakes": pyflakes_dist, "pycodestyle": pycodestyle_dist}
|
||||||
with mock.patch.object(importlib_metadata, "distribution", dists.get):
|
with mock.patch.object(importlib.metadata, "distribution", dists.get):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ def test_flake8_plugins(flake8_dist, mock_distribution):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pyflakes",
|
"pyflakes",
|
||||||
"9000.1.0",
|
"9000.1.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"F",
|
"F",
|
||||||
"flake8.plugins.pyflakes:FlakesChecker",
|
"flake8.plugins.pyflakes:FlakesChecker",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -181,7 +181,7 @@ def test_flake8_plugins(flake8_dist, mock_distribution):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pycodestyle",
|
"pycodestyle",
|
||||||
"9000.2.0",
|
"9000.2.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"E",
|
"E",
|
||||||
"flake8.plugins.pycodestyle:pycodestyle_logical",
|
"flake8.plugins.pycodestyle:pycodestyle_logical",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -190,7 +190,7 @@ def test_flake8_plugins(flake8_dist, mock_distribution):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pycodestyle",
|
"pycodestyle",
|
||||||
"9000.2.0",
|
"9000.2.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"W",
|
"W",
|
||||||
"flake8.plugins.pycodestyle:pycodestyle_physical",
|
"flake8.plugins.pycodestyle:pycodestyle_physical",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -199,14 +199,14 @@ def test_flake8_plugins(flake8_dist, mock_distribution):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8",
|
"flake8",
|
||||||
"9001",
|
"9001",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"default", "flake8.formatting.default:Default", "flake8.report"
|
"default", "flake8.formatting.default:Default", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8",
|
"flake8",
|
||||||
"9001",
|
"9001",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"pylint", "flake8.formatting.default:Pylint", "flake8.report"
|
"pylint", "flake8.formatting.default:Pylint", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -220,7 +220,7 @@ def test_importlib_plugins(
|
||||||
mock_distribution,
|
mock_distribution,
|
||||||
caplog,
|
caplog,
|
||||||
):
|
):
|
||||||
"""Ensure we can load plugins from importlib_metadata."""
|
"""Ensure we can load plugins from importlib.metadata."""
|
||||||
|
|
||||||
# make sure flake8-colors is skipped
|
# make sure flake8-colors is skipped
|
||||||
flake8_colors_metadata = """\
|
flake8_colors_metadata = """\
|
||||||
|
|
@ -236,7 +236,7 @@ flake8-colors = flake8_colors:ColorFormatter
|
||||||
flake8_colors_d.mkdir()
|
flake8_colors_d.mkdir()
|
||||||
flake8_colors_d.joinpath("METADATA").write_text(flake8_colors_metadata)
|
flake8_colors_d.joinpath("METADATA").write_text(flake8_colors_metadata)
|
||||||
flake8_colors_d.joinpath("entry_points.txt").write_text(flake8_colors_eps)
|
flake8_colors_d.joinpath("entry_points.txt").write_text(flake8_colors_eps)
|
||||||
flake8_colors_dist = importlib_metadata.PathDistribution(flake8_colors_d)
|
flake8_colors_dist = importlib.metadata.PathDistribution(flake8_colors_d)
|
||||||
|
|
||||||
unrelated_metadata = """\
|
unrelated_metadata = """\
|
||||||
Metadata-Version: 2.1
|
Metadata-Version: 2.1
|
||||||
|
|
@ -251,10 +251,10 @@ unrelated = unrelated:main
|
||||||
unrelated_d.mkdir()
|
unrelated_d.mkdir()
|
||||||
unrelated_d.joinpath("METADATA").write_text(unrelated_metadata)
|
unrelated_d.joinpath("METADATA").write_text(unrelated_metadata)
|
||||||
unrelated_d.joinpath("entry_points.txt").write_text(unrelated_eps)
|
unrelated_d.joinpath("entry_points.txt").write_text(unrelated_eps)
|
||||||
unrelated_dist = importlib_metadata.PathDistribution(unrelated_d)
|
unrelated_dist = importlib.metadata.PathDistribution(unrelated_d)
|
||||||
|
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
importlib_metadata,
|
importlib.metadata,
|
||||||
"distributions",
|
"distributions",
|
||||||
return_value=[
|
return_value=[
|
||||||
flake8_dist,
|
flake8_dist,
|
||||||
|
|
@ -269,14 +269,14 @@ unrelated = unrelated:main
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8-foo",
|
"flake8-foo",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"Q", "flake8_foo:Plugin", "flake8.extension"
|
"Q", "flake8_foo:Plugin", "flake8.extension"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pycodestyle",
|
"pycodestyle",
|
||||||
"9000.2.0",
|
"9000.2.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"E",
|
"E",
|
||||||
"flake8.plugins.pycodestyle:pycodestyle_logical",
|
"flake8.plugins.pycodestyle:pycodestyle_logical",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -285,7 +285,7 @@ unrelated = unrelated:main
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pycodestyle",
|
"pycodestyle",
|
||||||
"9000.2.0",
|
"9000.2.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"W",
|
"W",
|
||||||
"flake8.plugins.pycodestyle:pycodestyle_physical",
|
"flake8.plugins.pycodestyle:pycodestyle_physical",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -294,7 +294,7 @@ unrelated = unrelated:main
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pyflakes",
|
"pyflakes",
|
||||||
"9000.1.0",
|
"9000.1.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"F",
|
"F",
|
||||||
"flake8.plugins.pyflakes:FlakesChecker",
|
"flake8.plugins.pyflakes:FlakesChecker",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -303,21 +303,21 @@ unrelated = unrelated:main
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8",
|
"flake8",
|
||||||
"9001",
|
"9001",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"default", "flake8.formatting.default:Default", "flake8.report"
|
"default", "flake8.formatting.default:Default", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8",
|
"flake8",
|
||||||
"9001",
|
"9001",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"pylint", "flake8.formatting.default:Pylint", "flake8.report"
|
"pylint", "flake8.formatting.default:Pylint", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8-foo",
|
"flake8-foo",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"foo", "flake8_foo:Formatter", "flake8.report"
|
"foo", "flake8_foo:Formatter", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -336,7 +336,7 @@ def test_duplicate_dists(flake8_dist):
|
||||||
# some poorly packaged pythons put lib and lib64 on sys.path resulting in
|
# some poorly packaged pythons put lib and lib64 on sys.path resulting in
|
||||||
# duplicates from `importlib.metadata.distributions`
|
# duplicates from `importlib.metadata.distributions`
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
importlib_metadata,
|
importlib.metadata,
|
||||||
"distributions",
|
"distributions",
|
||||||
return_value=[
|
return_value=[
|
||||||
flake8_dist,
|
flake8_dist,
|
||||||
|
|
@ -369,7 +369,7 @@ def test_find_local_plugins(local_plugin_cfg):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"local",
|
"local",
|
||||||
"local",
|
"local",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"X",
|
"X",
|
||||||
"mod:attr",
|
"mod:attr",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -378,7 +378,7 @@ def test_find_local_plugins(local_plugin_cfg):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"local",
|
"local",
|
||||||
"local",
|
"local",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"Y",
|
"Y",
|
||||||
"mod2:attr",
|
"mod2:attr",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -387,7 +387,7 @@ def test_find_local_plugins(local_plugin_cfg):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"local",
|
"local",
|
||||||
"local",
|
"local",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"Z",
|
"Z",
|
||||||
"mod3:attr",
|
"mod3:attr",
|
||||||
"flake8.report",
|
"flake8.report",
|
||||||
|
|
@ -474,7 +474,7 @@ def test_find_plugins(
|
||||||
):
|
):
|
||||||
opts = finder.PluginOptions.blank()
|
opts = finder.PluginOptions.blank()
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
importlib_metadata,
|
importlib.metadata,
|
||||||
"distributions",
|
"distributions",
|
||||||
return_value=[flake8_dist, flake8_foo_dist],
|
return_value=[flake8_dist, flake8_foo_dist],
|
||||||
):
|
):
|
||||||
|
|
@ -484,52 +484,52 @@ def test_find_plugins(
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8",
|
"flake8",
|
||||||
"9001",
|
"9001",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"default", "flake8.formatting.default:Default", "flake8.report"
|
"default", "flake8.formatting.default:Default", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8",
|
"flake8",
|
||||||
"9001",
|
"9001",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"pylint", "flake8.formatting.default:Pylint", "flake8.report"
|
"pylint", "flake8.formatting.default:Pylint", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8-foo",
|
"flake8-foo",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"Q", "flake8_foo:Plugin", "flake8.extension"
|
"Q", "flake8_foo:Plugin", "flake8.extension"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8-foo",
|
"flake8-foo",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"foo", "flake8_foo:Formatter", "flake8.report"
|
"foo", "flake8_foo:Formatter", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"local",
|
"local",
|
||||||
"local",
|
"local",
|
||||||
importlib_metadata.EntryPoint("X", "mod:attr", "flake8.extension"),
|
importlib.metadata.EntryPoint("X", "mod:attr", "flake8.extension"),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"local",
|
"local",
|
||||||
"local",
|
"local",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"Y", "mod2:attr", "flake8.extension"
|
"Y", "mod2:attr", "flake8.extension"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"local",
|
"local",
|
||||||
"local",
|
"local",
|
||||||
importlib_metadata.EntryPoint("Z", "mod3:attr", "flake8.report"),
|
importlib.metadata.EntryPoint("Z", "mod3:attr", "flake8.report"),
|
||||||
),
|
),
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pycodestyle",
|
"pycodestyle",
|
||||||
"9000.2.0",
|
"9000.2.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"E",
|
"E",
|
||||||
"flake8.plugins.pycodestyle:pycodestyle_logical",
|
"flake8.plugins.pycodestyle:pycodestyle_logical",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -538,7 +538,7 @@ def test_find_plugins(
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pycodestyle",
|
"pycodestyle",
|
||||||
"9000.2.0",
|
"9000.2.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"W",
|
"W",
|
||||||
"flake8.plugins.pycodestyle:pycodestyle_physical",
|
"flake8.plugins.pycodestyle:pycodestyle_physical",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -547,7 +547,7 @@ def test_find_plugins(
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"pyflakes",
|
"pyflakes",
|
||||||
"9000.1.0",
|
"9000.1.0",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
"F",
|
"F",
|
||||||
"flake8.plugins.pyflakes:FlakesChecker",
|
"flake8.plugins.pyflakes:FlakesChecker",
|
||||||
"flake8.extension",
|
"flake8.extension",
|
||||||
|
|
@ -570,7 +570,7 @@ def test_find_plugins_plugin_is_present(flake8_foo_dist):
|
||||||
)
|
)
|
||||||
|
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
importlib_metadata,
|
importlib.metadata,
|
||||||
"distributions",
|
"distributions",
|
||||||
return_value=[flake8_foo_dist],
|
return_value=[flake8_foo_dist],
|
||||||
):
|
):
|
||||||
|
|
@ -593,7 +593,7 @@ def test_find_plugins_plugin_is_missing(flake8_dist, flake8_foo_dist):
|
||||||
)
|
)
|
||||||
|
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
importlib_metadata,
|
importlib.metadata,
|
||||||
"distributions",
|
"distributions",
|
||||||
return_value=[flake8_dist],
|
return_value=[flake8_dist],
|
||||||
):
|
):
|
||||||
|
|
@ -623,7 +623,7 @@ def test_find_plugins_name_normalization(flake8_foo_dist):
|
||||||
)
|
)
|
||||||
|
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
importlib_metadata,
|
importlib.metadata,
|
||||||
"distributions",
|
"distributions",
|
||||||
return_value=[flake8_foo_dist],
|
return_value=[flake8_foo_dist],
|
||||||
):
|
):
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import importlib.metadata
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from flake8._compat import importlib_metadata
|
|
||||||
from flake8.formatting import default
|
from flake8.formatting import default
|
||||||
from flake8.plugins import finder
|
from flake8.plugins import finder
|
||||||
from flake8.plugins import reporter
|
from flake8.plugins import reporter
|
||||||
|
|
@ -24,7 +24,7 @@ def reporters():
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"flake8",
|
"flake8",
|
||||||
"123",
|
"123",
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
name, f"{cls.__module__}:{cls.__name__}", "flake8.report"
|
name, f"{cls.__module__}:{cls.__name__}", "flake8.report"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import importlib.metadata
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from flake8._compat import importlib_metadata
|
|
||||||
from flake8.main import debug
|
from flake8.main import debug
|
||||||
from flake8.plugins import finder
|
from flake8.plugins import finder
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@ def test_debug_information():
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
pkg,
|
pkg,
|
||||||
version,
|
version,
|
||||||
importlib_metadata.EntryPoint(
|
importlib.metadata.EntryPoint(
|
||||||
ep_name, "dne:dne", "flake8.extension"
|
ep_name, "dne:dne", "flake8.extension"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import importlib.metadata
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import flake8
|
import flake8
|
||||||
from flake8 import checker
|
from flake8 import checker
|
||||||
from flake8._compat import importlib_metadata
|
|
||||||
from flake8.plugins import finder
|
from flake8.plugins import finder
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ def test_raises_exception_on_failed_plugin(tmp_path, default_options):
|
||||||
finder.Plugin(
|
finder.Plugin(
|
||||||
"plugin-name",
|
"plugin-name",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
importlib_metadata.EntryPoint("X", "dne:dne", "flake8.extension"),
|
importlib.metadata.EntryPoint("X", "dne:dne", "flake8.extension"),
|
||||||
),
|
),
|
||||||
mock.Mock(side_effect=ValueError),
|
mock.Mock(side_effect=ValueError),
|
||||||
{},
|
{},
|
||||||
|
|
|
||||||
2
tox.ini
2
tox.ini
|
|
@ -1,6 +1,6 @@
|
||||||
[tox]
|
[tox]
|
||||||
minversion=2.3.1
|
minversion=2.3.1
|
||||||
envlist = py37,py38,flake8,linters,docs
|
envlist = py,flake8,linters,docs
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue