Skip to content

Commit

Permalink
feat: drop support for flake8 2.x and remove flake8-polyfill requirem…
Browse files Browse the repository at this point in the history
…ent (#219)

* Fix pytest PytestDeprecationWarning warning during tests

* Drop support for flake8 v2.x

Removes flake8-polyfill dependency

* Remove flake8-polyfill dependency references

Pipfile.lock was not regenerated.

* Bump to v5.0.0

* Remove flake8 extra from travis configuration

* Add username/PR to changelog
  • Loading branch information
joxl authored and rubik committed Jun 8, 2021
1 parent bec1dbc commit 1142f60
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python:
- "3.9"
- "pypy3.5"
install:
- pip install .[flake8]
- pip install .
- pip install -r test_requirements.txt
script:
- make tests
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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)
--------------------

Expand Down
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ pytest-mock = "*"
[packages]
mando = ">=0.3,<0.4"
colorama = ">=0.3,<0.4"
flake8-polyfill = "*"
15 changes: 5 additions & 10 deletions radon/contrib/flake8.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from flake8_polyfill import options

from radon.complexity import add_inner_blocks
from radon.visitors import ComplexityVisitor

Expand All @@ -20,28 +18,25 @@ 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',
default=False,
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',
Expand Down
11 changes: 10 additions & 1 deletion radon/tests/run.py
Original file line number Diff line number Diff line change
@@ -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)
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
1 change: 0 additions & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
coverage
coveralls
flake8-polyfill
pytest>=5.0; python_version >= '3.0'
pytest>=2.7; python_version < '3.0'
pytest-mock
Expand Down

0 comments on commit 1142f60

Please sign in to comment.