Skip to content

Commit

Permalink
Update pep8-naming compatibility with flake8 (#210)
Browse files Browse the repository at this point in the history
`pep8-naming` tests fail for `flake8` v3/v4; avoid suggesting that it works 

Additionally, v6 added one more required `kwarg`. Let's add that one too.
  • Loading branch information
stdedos committed Dec 16, 2022
1 parent b3492ee commit af89472
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions run_tests.py
Expand Up @@ -72,10 +72,17 @@ def load_tests(lines):

def parse_options(checker, options):
"""Parse the CLI-style flags from `options` and expose to `checker`"""
extra_kwargs = {}
if flake8.__version_info__[0] >= 6:
extra_kwargs = {
"formatter_names": []
}

options_manager = OptionManager(
version=flake8.__version__,
plugin_versions=f"naming: {pep8ext_naming.__version__}",
parents=[],
**extra_kwargs,
)
options_manager.add_option('--select', default=[])
options_manager.add_option('--extended-default-select', default=['N'])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -42,7 +42,7 @@ def run_tests(self):
license='Expat license',
package_dir={'': 'src'},
py_modules=['pep8ext_naming'],
install_requires=['flake8>=3.9.1'],
install_requires=['flake8>=5.0.0'],
zip_safe=False,
python_requires='>=3.7',
entry_points={
Expand Down
12 changes: 10 additions & 2 deletions tox.ini
@@ -1,5 +1,11 @@
[tox]
envlist = py37,py38,py39,py310,py310-flake8,pypy3
envlist =
py37-flake85,
py38-flake8-{v5,v6,latest},
py39-flake8-{v5,v6,latest},
py310-flake8-{v5,v6,latest},
py310-flake8,
pypy3

[gh-actions]
python =
Expand All @@ -12,7 +18,9 @@ python =
[testenv]
commands = python run_tests.py
deps =
flake8 >= 5.0.0
flake8-v5: flake8 >= 5.0.0, < 6.0.0
flake8-v6: flake8 >= 6.0.0, < 7.0.0
flake8-latest: flake8

[testenv:py310-flake8]
basepython = python3.10
Expand Down

0 comments on commit af89472

Please sign in to comment.