Hello community, here is the log from the commit of package python-python-language-server for openSUSE:Factory checked in at 2020-01-07 23:52:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-python-language-server (Old) and /work/SRC/openSUSE:Factory/.python-python-language-server.new.6675 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-language-server" Tue Jan 7 23:52:59 2020 rev:2 rq:761349 version:0.31.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-python-language-server/python-python-language-server.changes 2019-12-10 22:42:47.345800972 +0100 +++ /work/SRC/openSUSE:Factory/.python-python-language-server.new.6675/python-python-language-server.changes 2020-01-07 23:53:20.260030819 +0100 @@ -1,0 +2,11 @@ +Tue Jan 7 08:01:27 CET 2020 - Matej Cepl <mc...@suse.com> + +- Update to 0.31.4: + - Address autopep8 overriding pycodestyle's + continued_indentation + - Fix TCPServer being bound before allow_reuse_address is set + - Fix tests for Jedi 0.15.2 + - Fix returned line numbers in McCabe plugin + - Add --config parameter for flake8 + +------------------------------------------------------------------- Old: ---- python-language-server-0.31.2.tar.gz New: ---- python-language-server-0.31.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-python-language-server.spec ++++++ --- /var/tmp/diff_new_pack.GhbBHc/_old 2020-01-07 23:53:20.896031149 +0100 +++ /var/tmp/diff_new_pack.GhbBHc/_new 2020-01-07 23:53:20.900031151 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-python-language-server # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-python-language-server -Version: 0.31.2 +Version: 0.31.4 Release: 0 Summary: Python Language Server for the Language Server Protocol License: MIT @@ -99,7 +99,8 @@ # Remove pytest addopts rm setup.cfg # One test failure on Leap 15.1 due to different pylint version -%pytest -k 'not test_syntax_error_pylint_py3' +SKIP_TESTS='test_syntax_error_pylint_py3' +%pytest -k "not $SKIP_TESTS" %files %{python_files} %doc README.rst ++++++ python-language-server-0.31.2.tar.gz -> python-language-server-0.31.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/PKG-INFO new/python-language-server-0.31.4/PKG-INFO --- old/python-language-server-0.31.2/PKG-INFO 2019-12-02 18:20:21.000000000 +0100 +++ new/python-language-server-0.31.4/PKG-INFO 2019-12-24 19:27:44.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: python-language-server -Version: 0.31.2 +Version: 0.31.4 Summary: Python Language Server for the Language Server Protocol Home-page: https://github.com/palantir/python-language-server Author: Palantir Technologies, Inc. @@ -169,13 +169,13 @@ Platform: UNKNOWN Provides-Extra: rope -Provides-Extra: all Provides-Extra: test -Provides-Extra: pydocstyle +Provides-Extra: pyflakes Provides-Extra: pylint -Provides-Extra: mccabe Provides-Extra: yapf -Provides-Extra: pyflakes +Provides-Extra: mccabe +Provides-Extra: pycodestyle +Provides-Extra: pydocstyle Provides-Extra: autopep8 +Provides-Extra: all Provides-Extra: flake8 -Provides-Extra: pycodestyle diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/pyls/_version.py new/python-language-server-0.31.4/pyls/_version.py --- old/python-language-server-0.31.2/pyls/_version.py 2019-12-02 18:20:21.000000000 +0100 +++ new/python-language-server-0.31.4/pyls/_version.py 2019-12-24 19:27:44.000000000 +0100 @@ -8,11 +8,11 @@ version_json = ''' { - "date": "2019-12-02T12:13:57-0500", + "date": "2019-12-24T13:22:52-0500", "dirty": false, "error": null, - "full-revisionid": "143d9931cd0cabe92e1370b344cb02c406e0b0f1", - "version": "0.31.2" + "full-revisionid": "0114c6cdf48010fc1614538a3f229a4992673aa6", + "version": "0.31.4" } ''' # END VERSION_JSON diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/pyls/plugins/flake8_lint.py new/python-language-server-0.31.4/pyls/plugins/flake8_lint.py --- old/python-language-server-0.31.2/pyls/plugins/flake8_lint.py 2019-12-02 18:20:20.000000000 +0100 +++ new/python-language-server-0.31.4/pyls/plugins/flake8_lint.py 2019-12-24 19:27:42.000000000 +0100 @@ -1,6 +1,7 @@ # Copyright 2019 Palantir Technologies, Inc. """Linter pluging for flake8""" import logging +from os import path import re from subprocess import Popen, PIPE from pyls import hookimpl, lsp @@ -20,6 +21,7 @@ log.debug("Got flake8 settings: %s", settings) opts = { + 'config': settings.get('config'), 'exclude': settings.get('exclude'), 'filename': settings.get('filename'), 'hang-closing': settings.get('hangClosing'), @@ -28,6 +30,14 @@ 'select': settings.get('select'), } + # flake takes only absolute path to the config. So we should check and + # convert if necessary + if opts.get('config') and not path.isabs(opts.get('config')): + opts['config'] = path.abspath(path.expanduser(path.expandvars( + opts.get('config') + ))) + log.debug("using flake8 with config: %s", opts['config']) + # Call the flake8 utility then parse diagnostics from stdout args = build_args(opts, document.path) output = run_flake8(args) @@ -64,16 +74,17 @@ """ args = [doc_path] for arg_name, arg_val in options.items(): + if arg_val is None: + continue arg = None if isinstance(arg_val, list): arg = '--{}={}'.format(arg_name, ','.join(arg_val)) elif isinstance(arg_val, bool): if arg_val: arg = '--{}'.format(arg_name) - elif isinstance(arg_val, int): + else: arg = '--{}={}'.format(arg_name, arg_val) - if arg: - args.append(arg) + args.append(arg) return args diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/pyls/plugins/mccabe_lint.py new/python-language-server-0.31.4/pyls/plugins/mccabe_lint.py --- old/python-language-server-0.31.2/pyls/plugins/mccabe_lint.py 2019-12-02 18:20:20.000000000 +0100 +++ new/python-language-server-0.31.4/pyls/plugins/mccabe_lint.py 2019-12-24 19:27:42.000000000 +0100 @@ -30,8 +30,8 @@ diags.append({ 'source': 'mccabe', 'range': { - 'start': {'line': graph.lineno, 'character': graph.column}, - 'end': {'line': graph.lineno, 'character': len(document.lines[graph.lineno])}, + 'start': {'line': graph.lineno - 1, 'character': graph.column}, + 'end': {'line': graph.lineno - 1, 'character': len(document.lines[graph.lineno])}, }, 'message': 'Cyclomatic complexity too high: %s (threshold %s)' % (graph.complexity(), threshold), 'severity': lsp.DiagnosticSeverity.Warning diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/pyls/plugins/pycodestyle_lint.py new/python-language-server-0.31.4/pyls/plugins/pycodestyle_lint.py --- old/python-language-server-0.31.2/pyls/plugins/pycodestyle_lint.py 2019-12-02 18:20:20.000000000 +0100 +++ new/python-language-server-0.31.4/pyls/plugins/pycodestyle_lint.py 2019-12-24 19:27:42.000000000 +0100 @@ -1,8 +1,16 @@ # Copyright 2017 Palantir Technologies, Inc. import logging import pycodestyle +from autopep8 import continued_indentation as autopep8_c_i from pyls import hookimpl, lsp +# Check if autopep8's continued_indentation implementation +# is overriding pycodestyle's and if so, re-register +# the check using pycodestyle's implementation as expected +if autopep8_c_i in pycodestyle._checks['logical_line']: + del pycodestyle._checks['logical_line'][autopep8_c_i] + pycodestyle.register_check(pycodestyle.continued_indentation) + log = logging.getLogger(__name__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/pyls/python_ls.py new/python-language-server-0.31.4/pyls/python_ls.py --- old/python-language-server-0.31.2/pyls/python_ls.py 2019-12-02 18:20:20.000000000 +0100 +++ new/python-language-server-0.31.4/pyls/python_ls.py 2019-12-24 19:27:42.000000000 +0100 @@ -68,10 +68,12 @@ 'SHUTDOWN_CALL': shutdown_server} ) - server = socketserver.TCPServer((bind_addr, port), wrapper_class) + server = socketserver.TCPServer((bind_addr, port), wrapper_class, bind_and_activate=False) server.allow_reuse_address = True try: + server.server_bind() + server.server_activate() log.info('Serving %s on (%s, %s)', handler_class.__name__, bind_addr, port) server.serve_forever() finally: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/python_language_server.egg-info/PKG-INFO new/python-language-server-0.31.4/python_language_server.egg-info/PKG-INFO --- old/python-language-server-0.31.2/python_language_server.egg-info/PKG-INFO 2019-12-02 18:20:21.000000000 +0100 +++ new/python-language-server-0.31.4/python_language_server.egg-info/PKG-INFO 2019-12-24 19:27:44.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: python-language-server -Version: 0.31.2 +Version: 0.31.4 Summary: Python Language Server for the Language Server Protocol Home-page: https://github.com/palantir/python-language-server Author: Palantir Technologies, Inc. @@ -169,13 +169,13 @@ Platform: UNKNOWN Provides-Extra: rope -Provides-Extra: all Provides-Extra: test -Provides-Extra: pydocstyle +Provides-Extra: pyflakes Provides-Extra: pylint -Provides-Extra: mccabe Provides-Extra: yapf -Provides-Extra: pyflakes +Provides-Extra: mccabe +Provides-Extra: pycodestyle +Provides-Extra: pydocstyle Provides-Extra: autopep8 +Provides-Extra: all Provides-Extra: flake8 -Provides-Extra: pycodestyle diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/test/plugins/test_completion.py new/python-language-server-0.31.4/test/plugins/test_completion.py --- old/python-language-server-0.31.2/test/plugins/test_completion.py 2019-12-02 18:20:20.000000000 +0100 +++ new/python-language-server-0.31.4/test/plugins/test_completion.py 2019-12-24 19:27:42.000000000 +0100 @@ -4,10 +4,10 @@ import sys from test.test_utils import MockWorkspace -import jedi import pytest from pyls import uris, lsp +from pyls._utils import JEDI_VERSION from pyls.workspace import Document from pyls.plugins.jedi_completion import pyls_completions as pyls_jedi_completions from pyls.plugins.rope_completion import pyls_completions as pyls_rope_completions @@ -124,20 +124,25 @@ assert everyone_method['insertText'] == 'everyone' -@pytest.mark.skipif(PY2 or LooseVersion(jedi.__version__) >= LooseVersion('0.16.0'), - reason='Test only with Jedi <0.16 in Python 3. Check for a fix in future Jedi versions') +@pytest.mark.skipif(PY2 or (sys.platform.startswith('linux') and os.environ.get('CI') is not None), + reason="Test in Python 3 and not on CIs on Linux because wheels don't work on them.") def test_pyqt_completion(config): # Over 'QA' in 'from PyQt5.QtWidgets import QApplication' doc_pyqt = "from PyQt5.QtWidgets import QA" com_position = {'line': 0, 'character': len(doc_pyqt)} doc = Document(DOC_URI, doc_pyqt) + completions = pyls_jedi_completions(config, doc, com_position) - # Test we don't throw importing elements from PyQt5 - assert pyls_jedi_completions(config, doc, com_position) is None + # Test we don't throw an error for Jedi < 0.15.2 and get completions + # for Jedi 0.15.2+ + if LooseVersion(JEDI_VERSION) < LooseVersion('0.15.2'): + assert completions is None + else: + assert completions is not None -@pytest.mark.skipif(LooseVersion('0.15.0') <= LooseVersion(jedi.__version__) < LooseVersion('0.16.0'), - reason='This test fails with Jedi 0.15') +@pytest.mark.skipif(LooseVersion('0.15.0') <= LooseVersion(JEDI_VERSION) < LooseVersion('0.15.2'), + reason='This test fails with Jedi 0.15.0 and 0.15.1') def test_numpy_completions(config): doc_numpy = "import numpy as np; np." com_position = {'line': 0, 'character': len(doc_numpy)} @@ -148,8 +153,8 @@ assert any(['array' in i['label'] for i in items]) -@pytest.mark.skipif(LooseVersion('0.15.0') <= LooseVersion(jedi.__version__) < LooseVersion('0.16.0'), - reason='This test fails with Jedi 0.15') +@pytest.mark.skipif(LooseVersion('0.15.0') <= LooseVersion(JEDI_VERSION) < LooseVersion('0.15.2'), + reason='This test fails with Jedi 0.15.0 and 0.15.1') def test_pandas_completions(config): doc_pandas = "import pandas as pd; pd." com_position = {'line': 0, 'character': len(doc_pandas)} @@ -170,6 +175,8 @@ assert any(['plot' in i['label'] for i in items]) +@pytest.mark.skipif(LooseVersion(JEDI_VERSION) < LooseVersion('0.15.2'), + reason='This test fails with Jedi 0.15.1 or less') def test_snippets_completion(config): doc_snippets = 'from collections import defaultdict \na=defaultdict' com_position = {'line': 0, 'character': 35} @@ -182,7 +189,7 @@ com_position = {'line': 1, 'character': len(doc_snippets)} completions = pyls_jedi_completions(config, doc, com_position) - out = 'defaultdict(${1:default_factory}, ${2:iterable}, ${3:kwargs})$0' + out = 'defaultdict(${1:kwargs})$0' assert completions[0]['insertText'] == out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/test/plugins/test_flake8_lint.py new/python-language-server-0.31.4/test/plugins/test_flake8_lint.py --- old/python-language-server-0.31.2/test/plugins/test_flake8_lint.py 2019-12-02 18:20:20.000000000 +0100 +++ new/python-language-server-0.31.4/test/plugins/test_flake8_lint.py 2019-12-24 19:27:42.000000000 +0100 @@ -1,6 +1,8 @@ # Copyright 2019 Palantir Technologies, Inc. import tempfile import os +from mock import patch + from pyls import lsp, uris from pyls.plugins import flake8_lint from pyls.workspace import Document @@ -50,3 +52,14 @@ finally: os.remove(name) + + +def test_flake8_config_param(config): + with patch('pyls.plugins.flake8_lint.Popen') as popen_mock: + flake8_conf = '/tmp/some.cfg' + config.update({'plugins': {'flake8': {'config': flake8_conf}}}) + _name, doc = temp_document(DOC) + flake8_lint.pyls_lint(config, doc) + call_args = popen_mock.call_args.args[0] + assert 'flake8' in call_args + assert '--config={}'.format(flake8_conf) in call_args diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/test/plugins/test_mccabe_lint.py new/python-language-server-0.31.4/test/plugins/test_mccabe_lint.py --- old/python-language-server-0.31.2/test/plugins/test_mccabe_lint.py 2019-12-02 18:20:20.000000000 +0100 +++ new/python-language-server-0.31.4/test/plugins/test_mccabe_lint.py 2019-12-24 19:27:42.000000000 +0100 @@ -26,8 +26,8 @@ mod_import = [d for d in diags if d['message'] == msg][0] assert mod_import['severity'] == lsp.DiagnosticSeverity.Warning - assert mod_import['range']['start'] == {'line': 1, 'character': 0} - assert mod_import['range']['end'] == {'line': 1, 'character': 6} + assert mod_import['range']['start'] == {'line': 0, 'character': 0} + assert mod_import['range']['end'] == {'line': 0, 'character': 6} finally: config._settings = old_settings diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-language-server-0.31.2/test/plugins/test_pycodestyle_lint.py new/python-language-server-0.31.4/test/plugins/test_pycodestyle_lint.py --- old/python-language-server-0.31.2/test/plugins/test_pycodestyle_lint.py 2019-12-02 18:20:20.000000000 +0100 +++ new/python-language-server-0.31.4/test/plugins/test_pycodestyle_lint.py 2019-12-24 19:27:42.000000000 +0100 @@ -10,6 +10,9 @@ def hello( ): \tpass +print("hello" + ,"world" +) import json @@ -37,8 +40,8 @@ assert mod_import['code'] == 'W391' assert mod_import['severity'] == lsp.DiagnosticSeverity.Warning - assert mod_import['range']['start'] == {'line': 7, 'character': 0} - assert mod_import['range']['end'] == {'line': 7, 'character': 1} + assert mod_import['range']['start'] == {'line': 10, 'character': 0} + assert mod_import['range']['end'] == {'line': 10, 'character': 1} msg = "E201 whitespace after '('" mod_import = [d for d in diags if d['message'] == msg][0] @@ -48,6 +51,14 @@ assert mod_import['range']['start'] == {'line': 2, 'character': 10} assert mod_import['range']['end'] == {'line': 2, 'character': 14} + msg = "E128 continuation line under-indented for visual indent" + mod_import = [d for d in diags if d['message'] == msg][0] + + assert mod_import['code'] == 'E128' + assert mod_import['severity'] == lsp.DiagnosticSeverity.Warning + assert mod_import['range']['start'] == {'line': 5, 'character': 1} + assert mod_import['range']['end'] == {'line': 5, 'character': 10} + def test_pycodestyle_config(workspace): """ Test that we load config files properly. @@ -74,7 +85,7 @@ assert [d for d in diags if d['code'] == 'W191'] content = { - 'setup.cfg': ('[pycodestyle]\nignore = W191, E201', True), + 'setup.cfg': ('[pycodestyle]\nignore = W191, E201, E128', True), 'tox.ini': ('', False) }