diff --git a/.travis.yml b/.travis.yml index b1c40ca..a55d193 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ python: - "3.9" - "pypy3.5" install: - - pip install .[flake8] + - pip install . - pip install -r test_requirements.txt script: - make tests diff --git a/CHANGELOG b/CHANGELOG index dcd5305..0c439da 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +5.0.0 (dev) +----------- + +- Drop support for flake8 < 3.x (removes `flake8-polyfill` dependency), by + @joxl: #219 + 4.5.2 (May 23, 2021) -------------------- diff --git a/Pipfile b/Pipfile index 373ffea..29bef3c 100644 --- a/Pipfile +++ b/Pipfile @@ -12,4 +12,3 @@ pytest-mock = "*" [packages] mando = ">=0.3,<0.4" colorama = ">=0.3,<0.4" -flake8-polyfill = "*" diff --git a/radon/contrib/flake8.py b/radon/contrib/flake8.py index c2391bc..2376f4d 100644 --- a/radon/contrib/flake8.py +++ b/radon/contrib/flake8.py @@ -1,5 +1,3 @@ -from flake8_polyfill import options - from radon.complexity import add_inner_blocks from radon.visitors import ComplexityVisitor @@ -20,19 +18,17 @@ def __init__(self, tree, filename): self.tree = tree @classmethod - def add_options(cls, parser): # pragma: no cover + def add_options(cls, option_manager): # pragma: no cover '''Add custom options to the global parser.''' - options.register( - parser, + option_manager.add_option( '--radon-max-cc', default=-1, action='store', - type='int', + type=int, help='Radon complexity threshold', parse_from_config=True, ) - options.register( - parser, + option_manager.add_option( '--radon-no-assert', dest='no_assert', action='store_true', @@ -40,8 +36,7 @@ def add_options(cls, parser): # pragma: no cover help='Radon will ignore assert statements', parse_from_config=True, ) - options.register( - parser, + option_manager.add_option( '--radon-show-closures', dest='show_closures', action='store_true', diff --git a/radon/tests/run.py b/radon/tests/run.py index dc6faed..27251b6 100644 --- a/radon/tests/run.py +++ b/radon/tests/run.py @@ -1,5 +1,14 @@ if __name__ == '__main__': import pytest - ret = pytest.main(['--strict']) + # see: https://docs.pytest.org/en/6.2.x/deprecations.html#the-strict-command-line-option + # This check can be removed once Python 2.x support is dropped as the new + # pytest option (--strict-markers) is available in pytest for all Python 3.x + from packaging import version + if version.parse(pytest.__version__) < version.parse('6.2'): + pytest_args = ['--strict'] + else: + pytest_args = ['--strict-markers'] + + ret = pytest.main(pytest_args) exit(ret) diff --git a/requirements.txt b/requirements.txt index 32f142f..e25eb4b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ mando>=0.6,<0.7 colorama==0.4.1;python_version<='3.4' colorama>=0.4.1;python_version>'3.4' -flake8_polyfill future diff --git a/setup.py b/setup.py index 9bc1dbc..b163157 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,6 @@ 'colorama==0.4.1;python_version<="3.4"', 'colorama>=0.4.1;python_version>"3.4"', 'future', - 'flake8-polyfill', ], entry_points={ 'console_scripts': ['radon = radon:main'], diff --git a/test_requirements.txt b/test_requirements.txt index fa82706..b49fd6f 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,6 +1,5 @@ coverage coveralls -flake8-polyfill pytest>=5.0; python_version >= '3.0' pytest>=2.7; python_version < '3.0' pytest-mock