Switch from flake8 to pytest-{mccabe,flakes,pep8}.
This commit is contained in:
parent
d8e58b5886
commit
36803cba06
13
.flake8
13
.flake8
@ -1,13 +0,0 @@
|
|||||||
# vim: ft=dosini fileencoding=utf-8:
|
|
||||||
|
|
||||||
[flake8]
|
|
||||||
# E265: Block comment should start with '#'
|
|
||||||
# E501: Line too long
|
|
||||||
# F841: unused variable
|
|
||||||
# F401: Unused import
|
|
||||||
# E402: module level import not at top of file
|
|
||||||
# E266: too many leading '#' for block comment
|
|
||||||
# W503: line break before binary operator
|
|
||||||
ignore=E265,E501,F841,F401,E402,E266,W503
|
|
||||||
max_complexity = 12
|
|
||||||
exclude=resources.py
|
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,3 +22,4 @@ __pycache__
|
|||||||
/htmlcov
|
/htmlcov
|
||||||
/.tox
|
/.tox
|
||||||
/testresults.html
|
/testresults.html
|
||||||
|
/.cache
|
||||||
|
@ -93,7 +93,9 @@ Currently, the following tools will be invoked when you run `tox`:
|
|||||||
|
|
||||||
* Unit tests using the Python
|
* Unit tests using the Python
|
||||||
https://docs.python.org/3.4/library/unittest.html[unittest] framework
|
https://docs.python.org/3.4/library/unittest.html[unittest] framework
|
||||||
* https://pypi.python.org/pypi/flake8/[flake8]
|
* https://pypi.python.org/pypi/pyflakes[pyflakes] via https://pypi.python.org/pypi/pytest-flakes[pytest-flakes]
|
||||||
|
* https://pypi.python.org/pypi/pep8[pep8] via https://pypi.python.org/pypi/pytest-pep8[pytest-pep8]
|
||||||
|
* https://pypi.python.org/pypi/mccabe[mccabe] via https://pypi.python.org/pypi/pytest-mccabe[pytest-mccabe]
|
||||||
* https://github.com/GreenSteam/pep257/[pep257]
|
* https://github.com/GreenSteam/pep257/[pep257]
|
||||||
* http://pylint.org/[pylint]
|
* http://pylint.org/[pylint]
|
||||||
* https://pypi.python.org/pypi/pyroma/[pyroma]
|
* https://pypi.python.org/pypi/pyroma/[pyroma]
|
||||||
|
@ -28,7 +28,6 @@ include doc/qutebrowser.1.asciidoc
|
|||||||
prune tests
|
prune tests
|
||||||
exclude qutebrowser.rcc
|
exclude qutebrowser.rcc
|
||||||
exclude .coveragerc
|
exclude .coveragerc
|
||||||
exclude .flake8
|
|
||||||
exclude .pylintrc
|
exclude .pylintrc
|
||||||
exclude .eslintrc
|
exclude .eslintrc
|
||||||
exclude doc/help
|
exclude doc/help
|
||||||
|
@ -606,7 +606,7 @@ class Quitter:
|
|||||||
# event loop, so we can shut down immediately.
|
# event loop, so we can shut down immediately.
|
||||||
self._shutdown(status)
|
self._shutdown(status)
|
||||||
|
|
||||||
def _shutdown(self, status): # noqa
|
def _shutdown(self, status):
|
||||||
"""Second stage of shutdown."""
|
"""Second stage of shutdown."""
|
||||||
log.destroy.debug("Stage 2 of shutting down...")
|
log.destroy.debug("Stage 2 of shutting down...")
|
||||||
if qApp is None:
|
if qApp is None:
|
||||||
|
@ -181,7 +181,7 @@ class NetworkManager(QNetworkAccessManager):
|
|||||||
request.deleteLater()
|
request.deleteLater()
|
||||||
self.shutting_down.emit()
|
self.shutting_down.emit()
|
||||||
|
|
||||||
if SSL_AVAILABLE: # noqa
|
if SSL_AVAILABLE: # pragma: no mccabe
|
||||||
@pyqtSlot('QNetworkReply*', 'QList<QSslError>')
|
@pyqtSlot('QNetworkReply*', 'QList<QSslError>')
|
||||||
def on_ssl_errors(self, reply, errors):
|
def on_ssl_errors(self, reply, errors):
|
||||||
"""Decide if SSL errors should be ignored or not.
|
"""Decide if SSL errors should be ignored or not.
|
||||||
|
@ -420,7 +420,7 @@ class Command:
|
|||||||
value = self._type_conv[param.name](value)
|
value = self._type_conv[param.name](value)
|
||||||
return name, value
|
return name, value
|
||||||
|
|
||||||
def _get_call_args(self, win_id): # noqa
|
def _get_call_args(self, win_id):
|
||||||
"""Get arguments for a function call.
|
"""Get arguments for a function call.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -190,7 +190,7 @@ class CrashHandler(QObject):
|
|||||||
objects = ""
|
objects = ""
|
||||||
return ExceptionInfo(pages, cmd_history, objects)
|
return ExceptionInfo(pages, cmd_history, objects)
|
||||||
|
|
||||||
def exception_hook(self, exctype, excvalue, tb): # noqa
|
def exception_hook(self, exctype, excvalue, tb):
|
||||||
"""Handle uncaught python exceptions.
|
"""Handle uncaught python exceptions.
|
||||||
|
|
||||||
It'll try very hard to write all open tabs to a file, and then exit
|
It'll try very hard to write all open tabs to a file, and then exit
|
||||||
|
@ -55,7 +55,7 @@ class ShellLexer:
|
|||||||
self.token = ''
|
self.token = ''
|
||||||
self.state = ' '
|
self.state = ' '
|
||||||
|
|
||||||
def __iter__(self): # noqa
|
def __iter__(self): # pragma: no mccabe
|
||||||
"""Read a raw token from the input stream."""
|
"""Read a raw token from the input stream."""
|
||||||
# pylint: disable=too-many-branches,too-many-statements
|
# pylint: disable=too-many-branches,too-many-statements
|
||||||
self.reset()
|
self.reset()
|
||||||
|
50
tox.ini
50
tox.ini
@ -4,7 +4,7 @@
|
|||||||
# and then run "tox" from this directory.
|
# and then run "tox" from this directory.
|
||||||
|
|
||||||
[tox]
|
[tox]
|
||||||
envlist = unittests,misc,pep257,flake8,pylint,pyroma,check-manifest
|
envlist = unittests,misc,pep257,pyflakes,pep8,mccabe,pylint,pyroma,check-manifest
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
@ -74,16 +74,40 @@ passenv = LANG
|
|||||||
# D402: First line should not be function's signature (false-positives)
|
# D402: First line should not be function's signature (false-positives)
|
||||||
commands = {envpython} -m pep257 scripts tests qutebrowser --ignore=D102,D103,D209,D402 '--match=(?!resources|test_content_disposition).*\.py'
|
commands = {envpython} -m pep257 scripts tests qutebrowser --ignore=D102,D103,D209,D402 '--match=(?!resources|test_content_disposition).*\.py'
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:pyflakes]
|
||||||
skip_install = true
|
# https://github.com/fschulze/pytest-flakes/issues/6
|
||||||
|
setenv = LANG=en_US.UTF-8
|
||||||
deps =
|
deps =
|
||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
pyflakes==0.8.1
|
py==1.4.27
|
||||||
pep8==1.5.7 # rq.filter: <1.6.0
|
pytest==2.7.1
|
||||||
flake8==2.4.0
|
pyflakes==0.9.0
|
||||||
|
pytest-flakes==0.2
|
||||||
commands =
|
commands =
|
||||||
{[testenv:mkvenv]commands}
|
{[testenv:mkvenv]commands}
|
||||||
{envdir}/bin/flake8 scripts tests qutebrowser --config=.flake8
|
{envpython} -m py.test -q --flakes -m flakes
|
||||||
|
|
||||||
|
[testenv:pep8]
|
||||||
|
deps =
|
||||||
|
-r{toxinidir}/requirements.txt
|
||||||
|
py==1.4.27
|
||||||
|
pytest==2.7.1
|
||||||
|
pep8==1.6.2
|
||||||
|
pytest-pep8==1.0.6
|
||||||
|
commands =
|
||||||
|
{[testenv:mkvenv]commands}
|
||||||
|
{envpython} -m py.test -q --pep8 -m pep8
|
||||||
|
|
||||||
|
[testenv:mccabe]
|
||||||
|
deps =
|
||||||
|
-r{toxinidir}/requirements.txt
|
||||||
|
py==1.4.27
|
||||||
|
pytest==2.7.1
|
||||||
|
mccabe==0.3
|
||||||
|
pytest-mccabe==0.1
|
||||||
|
commands =
|
||||||
|
{[testenv:mkvenv]commands}
|
||||||
|
{envpython} -m py.test -q --mccabe -m mccabe
|
||||||
|
|
||||||
[testenv:pyroma]
|
[testenv:pyroma]
|
||||||
skip_install = true
|
skip_install = true
|
||||||
@ -129,3 +153,15 @@ commands =
|
|||||||
norecursedirs = .tox .venv
|
norecursedirs = .tox .venv
|
||||||
markers =
|
markers =
|
||||||
gui: Tests using the GUI (e.g. spawning widgets)
|
gui: Tests using the GUI (e.g. spawning widgets)
|
||||||
|
flakes-ignore =
|
||||||
|
UnusedImport
|
||||||
|
UnusedVariable
|
||||||
|
resources.py ALL
|
||||||
|
pep8ignore =
|
||||||
|
E265 # Block comment should start with '#'
|
||||||
|
E501 # Line too long
|
||||||
|
E402 # module level import not at top of file
|
||||||
|
E266 # too many leading '#' for block comment
|
||||||
|
W503 # line break before binary operator
|
||||||
|
resources.py ALL
|
||||||
|
mccabe-complexity = 12
|
||||||
|
Loading…
Reference in New Issue
Block a user