diff --git a/.pylintrc b/.pylintrc index 47466081c..4ba3b0a71 100644 --- a/.pylintrc +++ b/.pylintrc @@ -44,7 +44,7 @@ docstring-min-length=3 [FORMAT] max-line-length=79 -ignore-long-lines=( +# # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify diff --git a/qutebrowser/misc/crashdialog.py b/qutebrowser/misc/crashdialog.py index 6296b190e..4a2244af4 100644 --- a/qutebrowser/misc/crashdialog.py +++ b/qutebrowser/misc/crashdialog.py @@ -100,7 +100,7 @@ def _get_environment_vars(): for key, value in os.environ.items(): for m in masks: if fnmatch.fnmatch(key, m): - info.append('%s = %s' % (key, value)) + info.append('{} = {}'.format(key, value)) return '\n'.join(sorted(info)) diff --git a/qutebrowser/misc/crashsignal.py b/qutebrowser/misc/crashsignal.py index 22ed92dea..22ed19d79 100644 --- a/qutebrowser/misc/crashsignal.py +++ b/qutebrowser/misc/crashsignal.py @@ -22,7 +22,7 @@ import os import sys import bdb -import pdb +import pdb # flake8: disable=T002 import signal import functools import faulthandler diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index e052e0c35..969a40368 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -1,5 +1,7 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2014-2016 Florian Bruhin (The-Compiler) +# # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify diff --git a/qutebrowser/misc/savemanager.py b/qutebrowser/misc/savemanager.py index ec3b6b63b..c2e1fea5a 100644 --- a/qutebrowser/misc/savemanager.py +++ b/qutebrowser/misc/savemanager.py @@ -86,9 +86,9 @@ class Saveable: (not config.get(*self._config_opt)) and (not explicit) and (not force)): if not silent: - log.save.debug("Not saving {} because autosaving has been " + log.save.debug("Not saving {name} because autosaving has been " "disabled by {cfg[0]} -> {cfg[1]}.".format( - self._name, cfg=self._config_opt)) + name=self._name, cfg=self._config_opt)) return do_save = self._dirty or (self._save_on_exit and is_exit) or force if not silent: diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index e80909aa9..1d73194e7 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -274,7 +274,7 @@ def qt_message_handler(msg_type, context, msg): # PNGs in Qt with broken color profile # https://bugreports.qt.io/browse/QTBUG-39788 'libpng warning: iCCP: Not recognizing known sRGB profile that has ' - 'been edited', # noqa + 'been edited', # flake8: disable=E131 'libpng warning: iCCP: known incorrect sRGB profile', # Hopefully harmless warning 'OpenType support missing for script ', @@ -312,7 +312,7 @@ def qt_message_handler(msg_type, context, msg): 'libpng warning: iCCP: known incorrect sRGB profile', # https://bugreports.qt.io/browse/QTBUG-47154 'virtual void QSslSocketBackendPrivate::transmit() SSLRead failed ' - 'with: -9805', # noqa + 'with: -9805', # flake8: disable=E131 ] # Messages which will trigger an exception immediately diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index b20e833c8..2db14a18b 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -217,9 +217,9 @@ def _has_explicit_scheme(url): # after the scheme delimiter. Since we don't know of any URIs # using this and want to support e.g. searching for scoped C++ # symbols, we treat this as not an URI anyways. - return (url.isValid() and url.scheme() - and not url.path().startswith(' ') - and not url.path().startswith(':')) + return (url.isValid() and url.scheme() and + not url.path().startswith(' ') and + not url.path().startswith(':')) def is_special_url(url): diff --git a/scripts/dev/ci_install.py b/scripts/dev/ci_install.py index f1b14db7e..9e3d1d25d 100644 --- a/scripts/dev/ci_install.py +++ b/scripts/dev/ci_install.py @@ -65,6 +65,7 @@ def check_setup(executable): print("Checking setup...") subprocess.check_call([executable, '-c', 'import PyQt5']) subprocess.check_call([executable, '-c', 'import sip']) + subprocess.check_call([executable, '--version']) if 'APPVEYOR' in os.environ: @@ -115,6 +116,14 @@ elif TRAVIS_OS == 'linux': print("apt-get install...") apt_get(['install'] + pkgs) + if TESTENV == 'flake8': + print("apt-get update...") + apt_get(['update']) + # We need an up-to-date Python because of: + # https://github.com/google/yapf/issues/46 + print("Updating Python...") + apt_get(['install', '-t', 'trusty-updates', 'python3.4']) + if TESTENV == 'eslint': subprocess.check_call(['sudo', 'npm', 'install', '-g', 'eslint']) else: diff --git a/scripts/dev/pylint_checkers/config.py b/scripts/dev/pylint_checkers/config.py index 77a69c14e..4a47c95ef 100644 --- a/scripts/dev/pylint_checkers/config.py +++ b/scripts/dev/pylint_checkers/config.py @@ -41,7 +41,8 @@ class ConfigChecker(checkers.BaseChecker): __implements__ = interfaces.IAstroidChecker name = 'config' msgs = { - 'E0000': ('"%s -> %s" is no valid config option.', 'bad-config-call', + 'E0000': ('"%s -> %s" is no valid config option.', # flake8: disable=S001 + 'bad-config-call', None), } priority = -1 diff --git a/scripts/dev/run_vulture.py b/scripts/dev/run_vulture.py index db520f924..6350ddea7 100755 --- a/scripts/dev/run_vulture.py +++ b/scripts/dev/run_vulture.py @@ -128,8 +128,8 @@ def report(items): for item in sorted(items, key=lambda e: (e.file.lower(), e.lineno)): relpath = os.path.relpath(item.file) path = relpath if not relpath.startswith('..') else item.file - output.append("%s:%d: Unused %s '%s'" % (path, item.lineno, item.typ, - item)) + output.append("{}:{}: Unused {} '{}'".format(path, item.lineno, + item.typ, item)) return output diff --git a/scripts/dev/src2asciidoc.py b/scripts/dev/src2asciidoc.py index 212d5ec1b..746a2ceaf 100755 --- a/scripts/dev/src2asciidoc.py +++ b/scripts/dev/src2asciidoc.py @@ -72,7 +72,8 @@ class UsageFormatter(argparse.HelpFormatter): result = "'{}'".format(action.metavar) elif action.choices is not None: choice_strs = [str(choice) for choice in action.choices] - result = '{%s}' % ','.join('*{}*'.format(e) for e in choice_strs) + result = ('{' + ','.join('*{}*'.format(e) for e in choice_strs) + + '}') else: result = "'{}'".format(default_metavar) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..715e6999e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,44 @@ +[flake8] +exclude = .venv,.hypothesis,.git,__pycache__,resources.py +# E128: continuation line under-indented for visual indent +# E226: missing whitespace around arithmetic operator +# 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 +# F401: Unused import +# N802: function name should be lowercase +# L101: The __init__ method of classes must not have a docstring +# L102: A docstring was incorrectly formatted. +# L103: A test docstring must not start with any form of the words "test", ... +# L201: Container literals must have a trailing comma +# L202: print is not allowed except for debugging. +# L203: pdb and compatible modules are not allowed except for debugging. +# L204: Implicit string literal concatenation is only allowed if every string +# being concatenated is parenthesize +# L207: pass is only necessary in non-optional suites containing no other +# statements. +# L302: The line was too long. +# P101: format string does contain unindexed parameters +# P102: docstring does contain unindexed parameters +# P103: other string does contain unindexed parameters +# D001: found assert_ replace it with assertTrue +ignore = + E128,E226,E265,E501,E402,E266, + F401, + N802, + L101,L102,L103,L201,L202,L203,L204,L207,L302, + P101,P102,P103, + D001 +max-complexity = 12 +putty-ignore = + /# pylint: disable=invalid-name/ : +N801,N806 + /# pragma: no mccabe/ : +C901 + /# flake8: disable=E131/ : +E131 + /# flake8: disable=N803/ : +N803 + /# flake8: disable=T002/ : +T002 + /# flake8: disable=F841/ : +F841 + /# flake8: disable=S001/ : +S001 +copyright-check = True +copyright-regexp = # Copyright [\d-]+ .* +copyright-min-file-size = 110 diff --git a/tests/conftest.py b/tests/conftest.py index 5fe4cda91..6b9c1feca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -76,8 +76,7 @@ def _apply_platform_markers(item): continue if 'reason' in marker.kwargs: - reason = '{}: {}'.format(default_reason, - marker.kwargs['reason']) + reason = '{}: {}'.format(default_reason, marker.kwargs['reason']) del marker.kwargs['reason'] else: reason = default_reason + '.' @@ -388,8 +387,10 @@ def py_proc(): """Get a python executable and args list which executes the given code.""" if getattr(sys, 'frozen', False): pytest.skip("Can't be run when frozen") + def func(code): return (sys.executable, ['-c', textwrap.dedent(code.strip('\n'))]) + return func diff --git a/tests/helpers/utils.py b/tests/helpers/utils.py index 9c3e06922..1c8f0db28 100644 --- a/tests/helpers/utils.py +++ b/tests/helpers/utils.py @@ -66,7 +66,6 @@ def partial_compare(val1, val2, *, indent=0): print_i("|---- to ----", indent) print_i(pprint.pformat(val2), indent + 1) - if val2 is Ellipsis: print_i("Ignoring ellipsis comparison", indent, error=True) return True diff --git a/tests/integration/features/test_prompts.py b/tests/integration/features/test_prompts.py index 9126597fb..613e03286 100644 --- a/tests/integration/features/test_prompts.py +++ b/tests/integration/features/test_prompts.py @@ -44,6 +44,7 @@ def wait_for_prompt(quteproc): quteproc.wait_for(message='Entering mode KeyMode.* (reason: question ' 'asked)') + @bdd.then("no prompt should be shown") def no_prompt_shown(quteproc): quteproc.ensure_not_logged(message='Entering mode KeyMode.* (reason: ' diff --git a/tests/integration/test_quteprocess.py b/tests/integration/test_quteprocess.py index 2e93dbd4d..03c20b32f 100644 --- a/tests/integration/test_quteprocess.py +++ b/tests/integration/test_quteprocess.py @@ -88,7 +88,7 @@ def test_quteprocess_quitting(qtbot, quteproc_process): 'category': 'init', 'module': 'earlyinit', 'function': 'init_log', - 'line': 280, + 'line': 280, 'message': 'Log initialized.', 'expected': False, } @@ -122,10 +122,10 @@ def test_quteprocess_quitting(qtbot, quteproc_process): } ), ( - '00:00:00 WARNING qt qxcbxsettings:"QXcbXSettings::' - 'QXcbXSettings(QXcbScreen*)":233 ' - 'QXcbXSettings::QXcbXSettings(QXcbScreen*) Failed to get selection ' - 'owner for XSETTINGS_S atom ', + '00:00:00 WARNING qt qxcbxsettings:"QXcbXSettings::' + 'QXcbXSettings(QXcbScreen*)":233 ' + 'QXcbXSettings::QXcbXSettings(QXcbScreen*) Failed to get selection ' + 'owner for XSETTINGS_S atom ', { 'module': 'qxcbxsettings', 'function': 'QXcbXSettings::QXcbXSettings(QXcbScreen*)', diff --git a/tests/integration/test_webserver.py b/tests/integration/test_webserver.py index 8588a1a62..5f0fa8ab0 100644 --- a/tests/integration/test_webserver.py +++ b/tests/integration/test_webserver.py @@ -52,11 +52,11 @@ def test_httpbin(httpbin, qtbot, path, content, expected): @pytest.mark.parametrize('line, verb, path, equal', [ - ({'verb': 'GET', 'path': '/', 'status': 200}, 'GET', '/', True), - ({'verb': 'GET', 'path': '/foo/', 'status': 200}, 'GET', '/foo', True), + ({'verb': 'GET', 'path': '/', 'status': 200}, 'GET', '/', True), + ({'verb': 'GET', 'path': '/foo/', 'status': 200}, 'GET', '/foo', True), - ({'verb': 'GET', 'path': '/', 'status': 200}, 'GET', '/foo', False), - ({'verb': 'POST', 'path': '/', 'status': 200}, 'GET', '/', False), + ({'verb': 'GET', 'path': '/', 'status': 200}, 'GET', '/foo', False), + ({'verb': 'POST', 'path': '/', 'status': 200}, 'GET', '/', False), ]) def test_expected_request(httpbin, line, verb, path, equal): expected = httpbin.ExpectedRequest(verb, path) diff --git a/tests/unit/browser/http/test_http.py b/tests/unit/browser/http/test_http.py index 4b8decf39..0196eee67 100644 --- a/tests/unit/browser/http/test_http.py +++ b/tests/unit/browser/http/test_http.py @@ -29,7 +29,6 @@ from PyQt5.QtCore import QUrl from qutebrowser.browser import http - class TestNoContentDisposition: """Test parse_content_disposition with no Content-Disposition header.""" diff --git a/tests/unit/browser/test_cache.py b/tests/unit/browser/test_cache.py index 4fcd0e506..de37f764a 100644 --- a/tests/unit/browser/test_cache.py +++ b/tests/unit/browser/test_cache.py @@ -100,7 +100,7 @@ def test_cache_size_leq_max_cache_size(config_stub, tmpdir): preload_cache(disk_cache, 'http://bar.net') assert disk_cache.expire() < limit # Add a threshold to the limit due to unforseeable Qt internals - assert disk_cache.cacheSize() < limit+100 + assert disk_cache.cacheSize() < limit + 100 def test_cache_size_deactivated(config_stub, tmpdir): @@ -249,7 +249,6 @@ def test_cache_deactivated_insert_data(config_stub, tmpdir): assert deactivated_cache.insert(device) is None - def test_cache_remove_data(config_stub, tmpdir): """Test if a previously inserted entry can be removed from the cache.""" config_stub.data = { diff --git a/tests/unit/browser/test_mhtml.py b/tests/unit/browser/test_mhtml.py index db700cf9e..82973c1ac 100644 --- a/tests/unit/browser/test_mhtml.py +++ b/tests/unit/browser/test_mhtml.py @@ -27,6 +27,7 @@ import pytest from qutebrowser.browser import mhtml + @pytest.fixture(autouse=True) def patch_uuid(monkeypatch): monkeypatch.setattr("uuid.uuid4", lambda: "UUID") diff --git a/tests/unit/browser/test_signalfilter.py b/tests/unit/browser/test_signalfilter.py index 5ec43dd7a..698bef681 100644 --- a/tests/unit/browser/test_signalfilter.py +++ b/tests/unit/browser/test_signalfilter.py @@ -82,6 +82,7 @@ def objects(): signal_filter.create(signaller.cur_statusbar_message, tab)) return Objects(signal_filter=signal_filter, signaller=signaller) + @pytest.yield_fixture def tabbed_browser(win_registry): tb = FakeTabbedBrowser() diff --git a/tests/unit/browser/test_tabhistory.py b/tests/unit/browser/test_tabhistory.py index 4462336ac..814fc1c65 100644 --- a/tests/unit/browser/test_tabhistory.py +++ b/tests/unit/browser/test_tabhistory.py @@ -42,8 +42,8 @@ ITEMS = [ # From https://github.com/OtterBrowser/otter-browser/issues/709#issuecomment-74749471 Item(QUrl('http://github.com/OtterBrowser/24/134/2344/otter-browser/' 'issues/709/'), - 'Page not found | github', - user_data={'zoom': 149, 'scroll-pos': QPoint(0, 0)}), + 'Page not found | github', + user_data={'zoom': 149, 'scroll-pos': QPoint(0, 0)}), Item(QUrl('https://mail.google.com/mail/u/0/#label/some+label/' '234lkjsd0932lkjf884jqwerdf4'), '"some label" - email@gmail.com - Gmail"', diff --git a/tests/unit/browser/test_webelem.py b/tests/unit/browser/test_webelem.py index 933f74ba4..654bd3a7d 100644 --- a/tests/unit/browser/test_webelem.py +++ b/tests/unit/browser/test_webelem.py @@ -67,7 +67,7 @@ def get_webelem(geometry=None, frame=None, null=False, style=None, elem.hasAttribute.side_effect = lambda k: k in attribute_dict elem.attribute.side_effect = lambda k: attribute_dict.get(k, '') elem.setAttribute.side_effect = (lambda k, v: - operator.setitem(attribute_dict, k, v)) + operator.setitem(attribute_dict, k, v)) elem.removeAttribute.side_effect = attribute_dict.pop elem.attributeNames.return_value = list(attribute_dict) @@ -112,7 +112,7 @@ class SelectionAndFilterTests: ('', [webelem.Group.all, webelem.Group.links, webelem.Group.prevnext, webelem.Group.url]), ('', [webelem.Group.all, - webelem.Group.url]), + webelem.Group.url]), ('', [webelem.Group.all]), ('', [webelem.Group.all, webelem.Group.links, diff --git a/tests/unit/commands/test_cmdutils.py b/tests/unit/commands/test_cmdutils.py index 69e066305..747dc868c 100644 --- a/tests/unit/commands/test_cmdutils.py +++ b/tests/unit/commands/test_cmdutils.py @@ -77,7 +77,6 @@ class TestCheckExclusive: assert str(excinfo.value) == "Only one of -x/-y/-z can be given!" - class TestRegister: # pylint: disable=unused-variable diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index d98a4bc9a..cb06364fd 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -97,7 +97,7 @@ class TestConfigParser: def test_invalid_value_interpolated(self, objects): """Test setting an invalid interpolated value.""" objects.cp.read_dict({'general': {'ignore-case': 'smart', - 'wrap-search': '${ignore-case}'}}) + 'wrap-search': '${ignore-case}'}}) objects.cfg._from_cp(objects.cp) with pytest.raises(configexc.ValidationError): objects.cfg._validate_all() @@ -105,7 +105,7 @@ class TestConfigParser: def test_interpolation(self, objects): """Test setting an interpolated value.""" objects.cp.read_dict({'general': {'ignore-case': 'false', - 'wrap-search': '${ignore-case}'}}) + 'wrap-search': '${ignore-case}'}}) objects.cfg._from_cp(objects.cp) assert not objects.cfg.get('general', 'ignore-case') assert not objects.cfg.get('general', 'wrap-search') diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index 02878912f..34f4329fc 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -362,7 +362,7 @@ class TestList: def test_validate_valid(self, klass, val): klass(none_ok=True).validate(val) - @pytest.mark.parametrize('val', ['', 'foo,,bar',]) + @pytest.mark.parametrize('val', ['', 'foo,,bar']) def test_validate_invalid(self, klass, val): with pytest.raises(configexc.ValidationError): klass().validate(val) @@ -1036,7 +1036,6 @@ class TestFont: font_xfail = pytest.mark.xfail(reason='FIXME: #103') - @pytest.fixture(params=[configtypes.Font, configtypes.QtFont]) def klass(self, request): return request.param diff --git a/tests/unit/misc/test_checkpyver.py b/tests/unit/misc/test_checkpyver.py index e7a55b3ff..aacd576f4 100644 --- a/tests/unit/misc/test_checkpyver.py +++ b/tests/unit/misc/test_checkpyver.py @@ -37,8 +37,9 @@ def test_python2(): """Run checkpyver with python 2.""" try: proc = subprocess.Popen(['python2', checkpyver.__file__, - '--no-err-windows'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + '--no-err-windows'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) stdout, stderr = proc.communicate() except FileNotFoundError: pytest.skip("python2 not found") diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py index d66f9198f..b6611d8e1 100644 --- a/tests/unit/misc/test_ipc.py +++ b/tests/unit/misc/test_ipc.py @@ -329,10 +329,10 @@ class TestListen: file_mode_ok = file_stat.st_mode & 0o777 == 0o700 dir_mode_ok = dir_stat.st_mode & 0o777 == 0o700 - print('sockdir: {} / owner {} / mode {:o}'.format(sockdir, - dir_stat.st_uid, dir_stat.st_mode)) - print('sockfile: {} / owner {} / mode {:o}'.format(sockfile, - file_stat.st_uid, file_stat.st_mode)) + print('sockdir: {} / owner {} / mode {:o}'.format( + sockdir, dir_stat.st_uid, dir_stat.st_mode)) + print('sockfile: {} / owner {} / mode {:o}'.format( + sockfile, file_stat.st_uid, file_stat.st_mode)) assert file_owner_ok or dir_owner_ok assert file_mode_ok or dir_mode_ok @@ -831,8 +831,8 @@ class TestSendOrListen: 'title: Error while connecting to running instance!', 'pre_text: ', 'post_text: Maybe another instance is running but frozen?', - 'exception text: Error while listening to IPC server: Error ' - 'string (error 4)', + ('exception text: Error while listening to IPC server: Error ' + 'string (error 4)'), ] assert caplog.records[0].msg == '\n'.join(error_msgs) diff --git a/tests/unit/misc/test_sessions.py b/tests/unit/misc/test_sessions.py index 3fdd6af0d..a688ef0d4 100644 --- a/tests/unit/misc/test_sessions.py +++ b/tests/unit/misc/test_sessions.py @@ -38,6 +38,7 @@ from qutebrowser.commands import cmdexc pytestmark = pytest.mark.qt_log_ignore('QIODevice::read.*: device not open', extend=True) + @pytest.fixture def sess_man(): """Fixture providing a SessionManager with no session dir.""" @@ -246,7 +247,7 @@ class TestSaveTab: items = [ Item(url=QUrl('http://www.example.com/'), title='Test title', - active=True), + active=True), Item(url=QUrl('http://www.example.com/'), title='Test title', user_data={'zoom': factor}), ] diff --git a/tests/unit/utils/test_debug.py b/tests/unit/utils/test_debug.py index 1cfe12291..035bd3e08 100644 --- a/tests/unit/utils/test_debug.py +++ b/tests/unit/utils/test_debug.py @@ -239,7 +239,6 @@ class TestGetAllObjects: def __repr__(self): return '<{}>'.format(self._name) - def test_get_all_objects(self, stubs, monkeypatch): # pylint: disable=unused-variable widgets = [self.Object('Widget 1'), self.Object('Widget 2')] @@ -248,8 +247,8 @@ class TestGetAllObjects: root = QObject() o1 = self.Object('Object 1', root) - o2 = self.Object('Object 2', o1) - o3 = self.Object('Object 3', root) + o2 = self.Object('Object 2', o1) # flake8: disable=F841 + o3 = self.Object('Object 3', root) # flake8: disable=F841 expected = textwrap.dedent(""" Qt widgets - 2 objects: diff --git a/tests/unit/utils/test_urlutils.py b/tests/unit/utils/test_urlutils.py index 4f85022b9..b2ab548b3 100644 --- a/tests/unit/utils/test_urlutils.py +++ b/tests/unit/utils/test_urlutils.py @@ -532,6 +532,7 @@ def test_same_domain(are_same, url1, url2): assert urlutils.same_domain(QUrl(url1), QUrl(url2)) == are_same assert urlutils.same_domain(QUrl(url2), QUrl(url1)) == are_same + @pytest.mark.parametrize('url1, url2', [ ('http://example.com', ''), ('', 'http://example.com'), @@ -618,7 +619,7 @@ class TestIncDecNumber: after decrementing.""" with pytest.raises(urlutils.IncDecError): urlutils.incdec_number(QUrl('http://example.com/page_0.html'), - 'decrement') + 'decrement') def test_invalid_url(self): """Test if incdec_number rejects an invalid URL.""" diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index b1a3d5007..da40a43d7 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -530,7 +530,6 @@ def test_parse_single_key(keystr, expected): assert utils._parse_single_key(keystr) == expected - @pytest.mark.parametrize('keystr, expected', [ ('', [utils.KeyInfo(Qt.Key_X, Qt.ControlModifier, '')]), ('x', [utils.KeyInfo(Qt.Key_X, Qt.NoModifier, 'x')]), diff --git a/tests/unit/utils/usertypes/test_enum.py b/tests/unit/utils/usertypes/test_enum.py index a77c62874..b78251171 100644 --- a/tests/unit/utils/usertypes/test_enum.py +++ b/tests/unit/utils/usertypes/test_enum.py @@ -44,7 +44,7 @@ def test_name(enum): def test_unknown(enum): """Test invalid values which should raise an AttributeError.""" with pytest.raises(AttributeError): - _ = enum.three + _ = enum.three # flake8: disable=F841 def test_start(): diff --git a/tox.ini b/tox.ini index f9d9b2d08..bd59d9400 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py34,py35,misc,vulture,pep257,pyflakes,pep8,mccabe,pylint,pyroma,check-manifest +envlist = py34,py35,misc,vulture,pep257,flake8,pylint,pyroma,check-manifest [testenv] # https://bitbucket.org/hpk42/tox/issue/246/ - only needed for Windows though @@ -147,50 +147,26 @@ deps = pep257==0.7.0 # D402: First line should not be function's signature (false-positives) commands = {envpython} -m pep257 scripts tests qutebrowser --ignore=D102,D103,D104,D105,D209,D211,D402 '--match=(?!resources|test_*).*\.py' -[testenv:pyflakes] -basepython = python3 -# https://github.com/fschulze/pytest-flakes/issues/6 -setenv = LANG=en_US.UTF-8 -passenv = -deps = - -r{toxinidir}/requirements.txt - apipkg==1.4 - execnet==1.4.1 - py==1.4.31 - pyflakes==1.0.0 - pytest==2.8.5 - pytest-flakes==1.0.1 -commands = - {envpython} -m py.test -q --flakes --ignore=tests --noconftest - -[testenv:pep8] +[testenv:flake8] basepython = python3 passenv = deps = -r{toxinidir}/requirements.txt - apipkg==1.4 - execnet==1.4.1 - pep8==1.7 - py==1.4.31 - pytest==2.8.5 - pytest-pep8==1.0.6 -commands = - {envpython} -m py.test -q --pep8 --ignore=tests --noconftest - - -[testenv:mccabe] -basepython = python3 -passenv = -deps = - -r{toxinidir}/requirements.txt - apipkg==1.4 - execnet==1.4.1 + flake8==2.5.1 + flake8-debugger==1.4.0 + pep8-naming==0.3.3 + flake8-putty==0.2.0 + ebb-lint==0.4.3 + flake8-copyright==0.1 mccabe==0.3.1 - py==1.4.31 - pytest==2.8.5 - pytest-mccabe==0.1 + pep8==1.7.0 + pyflakes==1.0.0 + flake8-string-format==0.2.1 + flake8-deprecated==0.2 + flake8-mock==0.2 + flake8-pep3101==0.2 commands = - {envpython} -m py.test -q --mccabe --ignore=tests --noconftest + {envpython} -m flake8 [testenv:pyroma] basepython = python3