Skip to content

Commit 1142f60

Browse files
joxlrubik
authored andcommitted
feat: drop support for flake8 2.x and remove flake8-polyfill requirement (#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
1 parent bec1dbc commit 1142f60

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ python:
99
- "3.9"
1010
- "pypy3.5"
1111
install:
12-
- pip install .[flake8]
12+
- pip install .
1313
- pip install -r test_requirements.txt
1414
script:
1515
- make tests

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
5.0.0 (dev)
2+
-----------
3+
4+
- Drop support for flake8 < 3.x (removes `flake8-polyfill` dependency), by
5+
@joxl: #219
6+
17
4.5.2 (May 23, 2021)
28
--------------------
39

Pipfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ pytest-mock = "*"
1212
[packages]
1313
mando = ">=0.3,<0.4"
1414
colorama = ">=0.3,<0.4"
15-
flake8-polyfill = "*"

radon/contrib/flake8.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from flake8_polyfill import options
2-
31
from radon.complexity import add_inner_blocks
42
from radon.visitors import ComplexityVisitor
53

@@ -20,28 +18,25 @@ def __init__(self, tree, filename):
2018
self.tree = tree
2119

2220
@classmethod
23-
def add_options(cls, parser): # pragma: no cover
21+
def add_options(cls, option_manager): # pragma: no cover
2422
'''Add custom options to the global parser.'''
25-
options.register(
26-
parser,
23+
option_manager.add_option(
2724
'--radon-max-cc',
2825
default=-1,
2926
action='store',
30-
type='int',
27+
type=int,
3128
help='Radon complexity threshold',
3229
parse_from_config=True,
3330
)
34-
options.register(
35-
parser,
31+
option_manager.add_option(
3632
'--radon-no-assert',
3733
dest='no_assert',
3834
action='store_true',
3935
default=False,
4036
help='Radon will ignore assert statements',
4137
parse_from_config=True,
4238
)
43-
options.register(
44-
parser,
39+
option_manager.add_option(
4540
'--radon-show-closures',
4641
dest='show_closures',
4742
action='store_true',

radon/tests/run.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
if __name__ == '__main__':
22
import pytest
33

4-
ret = pytest.main(['--strict'])
4+
# see: https://docs.pytest.org/en/6.2.x/deprecations.html#the-strict-command-line-option
5+
# This check can be removed once Python 2.x support is dropped as the new
6+
# pytest option (--strict-markers) is available in pytest for all Python 3.x
7+
from packaging import version
8+
if version.parse(pytest.__version__) < version.parse('6.2'):
9+
pytest_args = ['--strict']
10+
else:
11+
pytest_args = ['--strict-markers']
12+
13+
ret = pytest.main(pytest_args)
514
exit(ret)

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
mando>=0.6,<0.7
22
colorama==0.4.1;python_version<='3.4'
33
colorama>=0.4.1;python_version>'3.4'
4-
flake8_polyfill
54
future

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
'colorama==0.4.1;python_version<="3.4"',
2424
'colorama>=0.4.1;python_version>"3.4"',
2525
'future',
26-
'flake8-polyfill',
2726
],
2827
entry_points={
2928
'console_scripts': ['radon = radon:main'],

test_requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
coverage
22
coveralls
3-
flake8-polyfill
43
pytest>=5.0; python_version >= '3.0'
54
pytest>=2.7; python_version < '3.0'
65
pytest-mock

0 commit comments

Comments
 (0)