From 77aa8b4337c8150c58f04ad0e55d46f0586fedf1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 23 Aug 2016 07:45:31 +0200 Subject: [PATCH] pylint: Use ignored-modules for pytest See https://github.com/PyCQA/astroid/pull/357 --- .pylintrc | 2 ++ scripts/dev/freeze_tests.py | 2 +- tests/end2end/features/conftest.py | 8 -------- tests/end2end/features/test_marks_bdd.py | 2 -- tests/end2end/fixtures/quteprocess.py | 3 --- tests/end2end/fixtures/testprocess.py | 3 --- tests/end2end/test_hints_html.py | 2 -- tests/end2end/test_insert_mode.py | 2 -- tests/end2end/test_smoke.py | 1 - 9 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.pylintrc b/.pylintrc index 6d4037355..dda9e75ab 100644 --- a/.pylintrc +++ b/.pylintrc @@ -68,6 +68,8 @@ max-args=10 valid-metaclass-classmethod-first-arg=cls [TYPECHECK] +# WORKAROUND for https://github.com/PyCQA/astroid/pull/357 +ignored-modules=pytest # MsgType added as WORKAROUND for # https://bitbucket.org/logilab/pylint/issues/690/ # UnsetObject because pylint infers any objreg.get(...) as UnsetObject. diff --git a/scripts/dev/freeze_tests.py b/scripts/dev/freeze_tests.py index 571b581e6..9c57b10e1 100755 --- a/scripts/dev/freeze_tests.py +++ b/scripts/dev/freeze_tests.py @@ -53,7 +53,7 @@ def temp_git_commit_file(): def get_build_exe_options(): """Get build_exe options with additional includes.""" opts = freeze.get_build_exe_options(skip_html=True) - opts['includes'] += pytest.freeze_includes() # pylint: disable=no-member + opts['includes'] += pytest.freeze_includes() opts['includes'] += ['unittest.mock', 'PyQt5.QtTest', 'hypothesis', 'bs4', 'httpbin', 'jinja2.ext', 'cherrypy.wsgiserver', 'pstats'] diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index c919f670c..5738531fa 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -430,9 +430,7 @@ def compare_session(request, quteproc, expected): compared. """ if request.config.getoption('--qute-bdd-webengine'): - # pylint: disable=no-member pytest.xfail(reason="QtWebEngine TODO: Sessions are not implemented") - # pylint: enable=no-member quteproc.compare_session(expected) @@ -497,9 +495,7 @@ def check_open_tabs(quteproc, request, tabs): It expects a list of URLs, with an optional "(active)" suffix. """ if request.config.getoption('--qute-bdd-webengine'): - # pylint: disable=no-member pytest.xfail(reason="QtWebEngine TODO: Sessions are not implemented") - # pylint: enable=no-member session = quteproc.get_session() active_suffix = ' (active)' tabs = tabs.splitlines() @@ -556,9 +552,7 @@ def _get_scroll_values(quteproc): r"(?Phorizontally|vertically)")) def check_scrolled(request, quteproc, direction): if request.config.getoption('--qute-bdd-webengine'): - # pylint: disable=no-member pytest.xfail(reason="QtWebEngine TODO: Sessions are not implemented") - # pylint: enable=no-member x, y = _get_scroll_values(quteproc) if direction == 'horizontally': assert x != 0 @@ -571,9 +565,7 @@ def check_scrolled(request, quteproc, direction): @bdd.then("the page should not be scrolled") def check_not_scrolled(request, quteproc): if request.config.getoption('--qute-bdd-webengine'): - # pylint: disable=no-member pytest.xfail(reason="QtWebEngine TODO: Sessions are not implemented") - # pylint: enable=no-member x, y = _get_scroll_values(quteproc) assert x == 0 assert y == 0 diff --git a/tests/end2end/features/test_marks_bdd.py b/tests/end2end/features/test_marks_bdd.py index 01d9aa1ae..858456996 100644 --- a/tests/end2end/features/test_marks_bdd.py +++ b/tests/end2end/features/test_marks_bdd.py @@ -25,9 +25,7 @@ bdd.scenarios('marks.feature') @bdd.then(bdd.parsers.parse("the page should be scrolled to {x} {y}")) def check_y(request, quteproc, x, y): if request.config.getoption('--qute-bdd-webengine'): - # pylint: disable=no-member pytest.xfail(reason="QtWebEngine TODO: Sessions are not implemented") - # pylint: enable=no-member data = quteproc.get_session() pos = data['windows'][0]['tabs'][0]['history'][-1]['scroll-pos'] assert int(x) == pos['x'] diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index a4e66b22f..5b621af47 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -46,9 +46,6 @@ instance_counter = itertools.count() def is_ignored_qt_message(message): """Check if the message is listed in qt_log_ignore.""" - # pylint: disable=no-member - # WORKAROUND for https://bitbucket.org/logilab/pylint/issues/717/ - # we should switch to generated-members after that regexes = pytest.config.getini('qt_log_ignore') for regex in regexes: if re.match(regex, message): diff --git a/tests/end2end/fixtures/testprocess.py b/tests/end2end/fixtures/testprocess.py index 790e71a02..86a883aea 100644 --- a/tests/end2end/fixtures/testprocess.py +++ b/tests/end2end/fixtures/testprocess.py @@ -77,7 +77,6 @@ class Line: def _render_log(data, threshold=100): """Shorten the given log without -v and convert to a string.""" - # pylint: disable=no-member data = [str(d) for d in data] is_exception = any('Traceback (most recent call last):' in line for line in data) @@ -109,7 +108,6 @@ def pytest_runtest_makereport(item, call): # actually a tuple. This is handled similarily in pytest-qt too. return - # pylint: disable=no-member if pytest.config.getoption('--capture') == 'no': # Already printed live return @@ -153,7 +151,6 @@ class Process(QObject): def _log(self, line): """Add the given line to the captured log output.""" - # pylint: disable=no-member if pytest.config.getoption('--capture') == 'no': print(line) self.captured_log.append(line) diff --git a/tests/end2end/test_hints_html.py b/tests/end2end/test_hints_html.py index c5b2fd6bd..406e1bd46 100644 --- a/tests/end2end/test_hints_html.py +++ b/tests/end2end/test_hints_html.py @@ -93,9 +93,7 @@ def test_hints(test_name, zoom_text_only, zoom_level, find_implementation, parsed = _parse_file(test_name) if parsed.qtwebengine_todo is not None and webengine: - # pylint: disable=no-member pytest.xfail("QtWebEngine TODO: {}".format(parsed.qtwebengine_todo)) - # pylint: enable=no-member url_path = 'data/hints/html/{}'.format(test_name) quteproc.open_path(url_path) diff --git a/tests/end2end/test_insert_mode.py b/tests/end2end/test_insert_mode.py index 31a9be5ee..f8dc7a547 100644 --- a/tests/end2end/test_insert_mode.py +++ b/tests/end2end/test_insert_mode.py @@ -49,10 +49,8 @@ def test_insert_mode(file_name, elem_id, source, input_text, auto_insert, quteproc.press_keys(input_text) elif source == 'clipboard': if request.config.getoption('--qute-bdd-webengine'): - # pylint: disable=no-member pytest.xfail(reason="QtWebEngine TODO: :insert-text is not " "implemented") - # pylint: enable=no-member quteproc.send_cmd(':debug-set-fake-clipboard "{}"'.format(input_text)) quteproc.send_cmd(':insert-text {clipboard}') diff --git a/tests/end2end/test_smoke.py b/tests/end2end/test_smoke.py index 1e27cf13f..e0f73e11b 100644 --- a/tests/end2end/test_smoke.py +++ b/tests/end2end/test_smoke.py @@ -41,7 +41,6 @@ def test_smoke(cmd, capfd): if e.returncode == -signal.SIGSEGV: _out, err = capfd.readouterr() assert 'Uncaught exception' not in err - # pylint: disable=no-member # https://github.com/The-Compiler/qutebrowser/issues/1387 pytest.xfail("Ignoring segfault on exit...") else: