From e38a6b11fe0adf63864696167ddeff7b25778d92 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Fri, 29 Mar 2024 11:21:43 +0100 Subject: [PATCH 1/4] Bump pylint to >3.1,<4 --- binder/environment.yml | 2 +- requirements/main.yml | 2 +- setup.py | 2 +- spyder/dependencies.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binder/environment.yml b/binder/environment.yml index 1ec4b5d3a64..9abda78b98f 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -25,7 +25,7 @@ dependencies: - pickleshare >=0.4 - psutil >=5.3 - pygments >=2.0 -- pylint >=2.5.0,<3.1 +- pylint >=3.1,<4 - pylint-venv >=3.0.2 - pyls-spyder >=0.4.0 - pyqt >=5.10,<5.16 diff --git a/requirements/main.yml b/requirements/main.yml index 96d80b57e53..d3d2abd9ac7 100644 --- a/requirements/main.yml +++ b/requirements/main.yml @@ -23,7 +23,7 @@ dependencies: - pickleshare >=0.4 - psutil >=5.3 - pygments >=2.0 - - pylint >=2.5.0,<3.1 + - pylint >=3.1,<4 - pylint-venv >=3.0.2 - pyls-spyder >=0.4.0 - pyqt >=5.10,<5.16 diff --git a/setup.py b/setup.py index 7af75bfb9a1..b79cfae5b0e 100644 --- a/setup.py +++ b/setup.py @@ -226,7 +226,7 @@ def run(self): 'pickleshare>=0.4', 'psutil>=5.3', 'pygments>=2.0', - 'pylint>=2.5.0,<3.1', + 'pylint>=3.1,<4', 'pylint-venv>=3.0.2', 'python-lsp-black>=2.0.0,<3.0.0', 'pyls-spyder>=0.4.0', diff --git a/spyder/dependencies.py b/spyder/dependencies.py index e1d12f7460d..a5d2440cc20 100644 --- a/spyder/dependencies.py +++ b/spyder/dependencies.py @@ -56,7 +56,7 @@ PICKLESHARE_REQVER = '>=0.4' PSUTIL_REQVER = '>=5.3' PYGMENTS_REQVER = '>=2.0' -PYLINT_REQVER = '>=2.5.0,<3.1' +PYLINT_REQVER = '>=3.1,<4' PYLINT_VENV_REQVER = '>=3.0.2' PYLSP_REQVER = '>=1.10.0,<1.11.0' PYLSP_BLACK_REQVER = '>=2.0.0,<3.0.0' From 0a593cae3881eedadeb87ecd0af4c079d4ed0868 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Fri, 29 Mar 2024 17:37:42 +0100 Subject: [PATCH 2/4] Bump pylsp to 1.11.0 --- binder/environment.yml | 2 +- requirements/main.yml | 2 +- setup.py | 2 +- spyder/dependencies.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binder/environment.yml b/binder/environment.yml index 9abda78b98f..44fd98735fc 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -31,7 +31,7 @@ dependencies: - pyqt >=5.10,<5.16 - pyqtwebengine >=5.10,<5.16 - python-lsp-black >=2.0.0,<3.0.0 -- python-lsp-server >=1.10.0,<1.11.0 +- python-lsp-server >=1.11.0,<1.12.0 - pyxdg >=0.26 - pyzmq >=24.0.0 - qdarkstyle >=3.2.0,<3.3.0 diff --git a/requirements/main.yml b/requirements/main.yml index d3d2abd9ac7..d41950ee525 100644 --- a/requirements/main.yml +++ b/requirements/main.yml @@ -29,7 +29,7 @@ dependencies: - pyqt >=5.10,<5.16 - pyqtwebengine >=5.10,<5.16 - python-lsp-black >=2.0.0,<3.0.0 - - python-lsp-server >=1.10.0,<1.11.0 + - python-lsp-server >=1.11.0,<1.12.0 - pyzmq >=24.0.0 - qdarkstyle >=3.2.0,<3.3.0 - qstylizer >=0.2.2 diff --git a/setup.py b/setup.py index b79cfae5b0e..a9008a67176 100644 --- a/setup.py +++ b/setup.py @@ -232,7 +232,7 @@ def run(self): 'pyls-spyder>=0.4.0', 'pyqt5>=5.10,<5.16', 'pyqtwebengine>=5.10,<5.16', - 'python-lsp-server[all]>=1.10.0,<1.11.0', + 'python-lsp-server[all]>=1.11.0,<1.12.0', 'pyxdg>=0.26;platform_system=="Linux"', 'pyzmq>=24.0.0', 'qdarkstyle>=3.2.0,<3.3.0', diff --git a/spyder/dependencies.py b/spyder/dependencies.py index a5d2440cc20..32c460f1bbb 100644 --- a/spyder/dependencies.py +++ b/spyder/dependencies.py @@ -58,7 +58,7 @@ PYGMENTS_REQVER = '>=2.0' PYLINT_REQVER = '>=3.1,<4' PYLINT_VENV_REQVER = '>=3.0.2' -PYLSP_REQVER = '>=1.10.0,<1.11.0' +PYLSP_REQVER = '>=1.11.0,<1.12.0' PYLSP_BLACK_REQVER = '>=2.0.0,<3.0.0' PYLS_SPYDER_REQVER = '>=0.4.0' PYXDG_REQVER = '>=0.26' From 736e7e541d5805b09d95c349d896cadc34170dc6 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Fri, 29 Mar 2024 21:34:30 +0100 Subject: [PATCH 3/4] Bump pylsp for development to < 1.13 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a9008a67176..0a265b4b473 100644 --- a/setup.py +++ b/setup.py @@ -254,7 +254,7 @@ def run(self): reqs_to_loosen = {'python-lsp-server[all]', 'qtconsole', 'spyder-kernels'} install_requires = [req for req in install_requires if req.split(">")[0] not in reqs_to_loosen] - install_requires.append('python-lsp-server[all]>=1.10.0,<1.12.0') + install_requires.append('python-lsp-server[all]>=1.11.0,<1.13.0') install_requires.append('qtconsole>=5.5.1,<5.7.0') install_requires.append('spyder-kernels>=2.5.1,<2.7.0') From 1cfe2c375deb320d303586144ae974d22193172a Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Fri, 29 Mar 2024 21:34:46 +0100 Subject: [PATCH 4/4] git subrepo pull --remote=https://github.com/python-lsp/python-lsp-server.git --branch=develop --update --force external-deps/python-lsp-server subrepo: subdir: "external-deps/python-lsp-server" merged: "4c0e99b41" upstream: origin: "https://github.com/python-lsp/python-lsp-server.git" branch: "develop" commit: "4c0e99b41" git-subrepo: version: "0.4.6" origin: "???" commit: "???" --- external-deps/python-lsp-server/.gitrepo | 6 +- external-deps/python-lsp-server/CHANGELOG.md | 44 +++++++++++ .../python-lsp-server/CONTRIBUTING.md | 40 ++++++++++ external-deps/python-lsp-server/README.md | 4 +- .../python-lsp-server/pylsp/_utils.py | 4 +- .../pylsp/plugins/flake8_lint.py | 1 + .../pylsp/plugins/jedi_rename.py | 2 +- .../pylsp/plugins/pylint_lint.py | 1 + .../pylsp/plugins/rope_autoimport.py | 2 +- .../pylsp/plugins/rope_rename.py | 66 ----------------- .../python-lsp-server/pylsp/python_lsp.py | 8 +- external-deps/python-lsp-server/pylsp/uris.py | 1 + .../python-lsp-server/pyproject.toml | 7 +- .../python-lsp-server/test/conftest.py | 3 +- .../test/plugins/test_autoimport.py | 2 +- .../test/plugins/test_rope_rename.py | 73 ------------------- 16 files changed, 108 insertions(+), 156 deletions(-) create mode 100644 external-deps/python-lsp-server/CONTRIBUTING.md delete mode 100644 external-deps/python-lsp-server/pylsp/plugins/rope_rename.py delete mode 100644 external-deps/python-lsp-server/test/plugins/test_rope_rename.py diff --git a/external-deps/python-lsp-server/.gitrepo b/external-deps/python-lsp-server/.gitrepo index 3df24fa3919..84f938cb79d 100644 --- a/external-deps/python-lsp-server/.gitrepo +++ b/external-deps/python-lsp-server/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/python-lsp/python-lsp-server.git branch = develop - commit = 5a383df418d2800b5abc5dd3a43b3061026fda07 - parent = 71e053bf7d815c0176974f9c9d5031b64946a8d9 + commit = 4c0e99b41ed39c514d0173fde72f7ac9d147662b + parent = 1800d90cb7f94df24ca762cc51537dc27b8df5a6 method = merge - cmdver = 0.4.3 + cmdver = 0.4.6 diff --git a/external-deps/python-lsp-server/CHANGELOG.md b/external-deps/python-lsp-server/CHANGELOG.md index 2993da97172..dcc85065903 100644 --- a/external-deps/python-lsp-server/CHANGELOG.md +++ b/external-deps/python-lsp-server/CHANGELOG.md @@ -1,5 +1,49 @@ # History of changes +## Version 1.11.0 (2024/03/29) + +### New features + +* Remove the `rope_rename` plugin. People that were using it need to install + the `pylsp-rope` third-party plugin instead. +* Add support for Pylint 3.1 + +### Issues Closed + +* [Issue 255](https://github.com/python-lsp/python-lsp-server/issues/255) - Confusion about rename support ([PR 515](https://github.com/python-lsp/python-lsp-server/pull/515) by [@doolio](https://github.com/doolio)) + +In this release 1 issue was closed. + +### Pull Requests Merged + +* [PR 543](https://github.com/python-lsp/python-lsp-server/pull/543) - Bump pylint to `>=3.1,<4`, by [@bnavigator](https://github.com/bnavigator) +* [PR 541](https://github.com/python-lsp/python-lsp-server/pull/541) - Add fallback for `ujson` import, by [@Savalek](https://github.com/Savalek) +* [PR 538](https://github.com/python-lsp/python-lsp-server/pull/538) - Remove `.config/flake8` reference in Readme, by [@justin-f-perez](https://github.com/justin-f-perez) +* [PR 536](https://github.com/python-lsp/python-lsp-server/pull/536) - Fix isort plugin name in Readme, by [@Piraty](https://github.com/Piraty) +* [PR 515](https://github.com/python-lsp/python-lsp-server/pull/515) - Remove built-in `rope_rename` plugin, by [@doolio](https://github.com/doolio) ([255](https://github.com/python-lsp/python-lsp-server/issues/255)) +* [PR 470](https://github.com/python-lsp/python-lsp-server/pull/470) - Add contributing guide to setup dev environment, by [@staticf0x](https://github.com/staticf0x) + +In this release 6 pull requests were closed. + +---- + +## Version 1.10.1 (2024/03/12) + +### Issues Closed + +* [Issue 529](https://github.com/python-lsp/python-lsp-server/issues/529) - Autoimports: sqlite3.OperationalError: database is locked ([PR 530](https://github.com/python-lsp/python-lsp-server/pull/530) by [@last-partizan](https://github.com/last-partizan)) + +In this release 1 issue was closed. + +### Pull Requests Merged + +* [PR 530](https://github.com/python-lsp/python-lsp-server/pull/530) - Fix progress reporting with autoimport plugin, by [@last-partizan](https://github.com/last-partizan) ([529](https://github.com/python-lsp/python-lsp-server/issues/529)) +* [PR 528](https://github.com/python-lsp/python-lsp-server/pull/528) - Improve error message about missing `websockets` module, by [@tomplus](https://github.com/tomplus) + +In this release 2 pull requests were closed. + +---- + ## Version 1.10.0 (2024/01/21) ### New features diff --git a/external-deps/python-lsp-server/CONTRIBUTING.md b/external-deps/python-lsp-server/CONTRIBUTING.md new file mode 100644 index 00000000000..5a24957b136 --- /dev/null +++ b/external-deps/python-lsp-server/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# Setup the environment + +1. Clone the repo: `git clone git@github.com:python-lsp/python-lsp-server.git` +2. Create the virtual environment: `python -m venv .venv` +3. Activate: `source .venv/bin/activate` +4. Install an editable installation: `pip install -e .` + - This will ensure you'll see your edits immediately without reinstalling the project +5. Configure your editor to point the pylsp executable to the one in `.venv` + +## Trying out if it works + +Go to file `pylsp/python_lsp.py`, function `start_io_lang_server`, +and on the first line of the function, add some logging: + +```py +log.info("It works!") +``` + +Save the file, restart the LSP server and you should see the log line: + +``` +2023-10-12 16:46:38,320 CEST - INFO - pylsp._utils - It works! +``` + +Now the project is setup in a way you can quickly iterate change you want to add. + +# Running tests + +1. Install runtime dependencies: `pip install .[all]` +2. Install test dependencies: `pip install .[test]` +3. Run `pytest`: `pytest -v` + +## Useful pytest options + +- To run a specific test file, use `pytest test/test_utils.py` +- To run a specific test function within a test file, + use `pytest test/test_utils.py::test_debounce` +- To run tests matching a certain expression, use `pytest -k format` +- To increase verbosity of pytest, use `pytest -v` or `pytest -vv` +- To enter a debugger on failed tests, use `pytest --pdb` diff --git a/external-deps/python-lsp-server/README.md b/external-deps/python-lsp-server/README.md index 51ec4f7e7a9..85d64522d4c 100644 --- a/external-deps/python-lsp-server/README.md +++ b/external-deps/python-lsp-server/README.md @@ -82,7 +82,7 @@ apk add py3-lsp-server Installing these plugins will add extra functionality to the language server: - [pylsp-mypy](https://github.com/Richardk2n/pylsp-mypy): [MyPy](http://mypy-lang.org/) type checking for Python >=3.8. -- [pyls-isort](https://github.com/chantera/python-lsp-isort): code formatting using [isort](https://github.com/PyCQA/isort) (automatic import sorting). +- [python-lsp-isort](https://github.com/chantera/python-lsp-isort): code formatting using [isort](https://github.com/PyCQA/isort) (automatic import sorting). - [python-lsp-black](https://github.com/python-lsp/python-lsp-black): code formatting using [Black](https://github.com/psf/black). - [pyls-memestra](https://github.com/QuantStack/pyls-memestra): detecting the use of deprecated APIs. - [pylsp-rope](https://github.com/python-rope/pylsp-rope): Extended refactoring capabilities using [Rope](https://github.com/python-rope/rope). @@ -101,7 +101,7 @@ Like all language servers, configuration can be passed from the client that talk `python-lsp-server` depends on other tools, like flake8 and pycodestyle. These tools can be configured via settings passed from the client (as above), or alternatively from other configuration sources. The following sources are available: - `pycodestyle`: discovered in `~/.config/pycodestyle`, `setup.cfg`, `tox.ini` and `pycodestyle.cfg`. -- `flake8`: discovered in `~/.config/flake8`, `.flake8`, `setup.cfg` and `tox.ini` +- `flake8`: discovered in `.flake8`, `setup.cfg` and `tox.ini` The default configuration sources are `pycodestyle` and `pyflakes`. If you would like to use `flake8`, you will need to: diff --git a/external-deps/python-lsp-server/pylsp/_utils.py b/external-deps/python-lsp-server/pylsp/_utils.py index e1d2b53cb8d..0293ee32f14 100644 --- a/external-deps/python-lsp-server/pylsp/_utils.py +++ b/external-deps/python-lsp-server/pylsp/_utils.py @@ -175,8 +175,8 @@ def escape_plain_text(contents: str) -> str: """ Format plain text to display nicely in environments which do not respect whitespaces. """ - contents = contents.replace("\t", "\u00A0" * 4) - contents = contents.replace(" ", "\u00A0" * 2) + contents = contents.replace("\t", "\u00a0" * 4) + contents = contents.replace(" ", "\u00a0" * 2) return contents diff --git a/external-deps/python-lsp-server/pylsp/plugins/flake8_lint.py b/external-deps/python-lsp-server/pylsp/plugins/flake8_lint.py index eed673f7367..47121018f0c 100644 --- a/external-deps/python-lsp-server/pylsp/plugins/flake8_lint.py +++ b/external-deps/python-lsp-server/pylsp/plugins/flake8_lint.py @@ -2,6 +2,7 @@ # Copyright 2021- Python Language Server Contributors. """Linter pluging for flake8""" + import logging import os.path import re diff --git a/external-deps/python-lsp-server/pylsp/plugins/jedi_rename.py b/external-deps/python-lsp-server/pylsp/plugins/jedi_rename.py index 5606a88132c..b35e321afd5 100644 --- a/external-deps/python-lsp-server/pylsp/plugins/jedi_rename.py +++ b/external-deps/python-lsp-server/pylsp/plugins/jedi_rename.py @@ -20,7 +20,7 @@ def pylsp_rename(config, workspace, document, position, new_name): except NotImplementedError as exc: raise Exception( "No support for renaming in Python 2/3.5 with Jedi. " - "Consider using the rope_rename plugin instead" + "Consider using the pylsp-rope plugin instead" ) from exc log.debug("Finished rename: %s", refactoring.get_diff()) changes = [] diff --git a/external-deps/python-lsp-server/pylsp/plugins/pylint_lint.py b/external-deps/python-lsp-server/pylsp/plugins/pylint_lint.py index 784627b1f0e..beffe6f3bee 100644 --- a/external-deps/python-lsp-server/pylsp/plugins/pylint_lint.py +++ b/external-deps/python-lsp-server/pylsp/plugins/pylint_lint.py @@ -3,6 +3,7 @@ # Copyright 2021- Python Language Server Contributors. """Linter plugin for pylint.""" + import collections import logging import os diff --git a/external-deps/python-lsp-server/pylsp/plugins/rope_autoimport.py b/external-deps/python-lsp-server/pylsp/plugins/rope_autoimport.py index 1a235c3da6b..759f0922ff2 100644 --- a/external-deps/python-lsp-server/pylsp/plugins/rope_autoimport.py +++ b/external-deps/python-lsp-server/pylsp/plugins/rope_autoimport.py @@ -37,7 +37,7 @@ def reload_cache( config: Config, workspace: Workspace, files: Optional[List[Document]] = None, - single_thread: Optional[bool] = False, + single_thread: Optional[bool] = True, ): if self.is_blocked(): return diff --git a/external-deps/python-lsp-server/pylsp/plugins/rope_rename.py b/external-deps/python-lsp-server/pylsp/plugins/rope_rename.py deleted file mode 100644 index 9e386944819..00000000000 --- a/external-deps/python-lsp-server/pylsp/plugins/rope_rename.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2017-2020 Palantir Technologies, Inc. -# Copyright 2021- Python Language Server Contributors. - -import logging - -from rope.base import libutils -from rope.refactor.rename import Rename - -from pylsp import _utils, hookimpl, uris - -log = logging.getLogger(__name__) - - -@hookimpl -def pylsp_settings(): - # Default rope_rename to disabled - return {"plugins": {"rope_rename": {"enabled": False}}} - - -@hookimpl -def pylsp_rename(config, workspace, document, position, new_name): - rope_config = config.settings(document_path=document.path).get("rope", {}) - rope_project = workspace._rope_project_builder(rope_config) - - rename = Rename( - rope_project, - libutils.path_to_resource(rope_project, document.path), - document.offset_at_position(position), - ) - - log.debug( - "Executing rename of %s to %s", document.word_at_position(position), new_name - ) - changeset = rename.get_changes(new_name, in_hierarchy=True, docs=True) - log.debug("Finished rename: %s", changeset.changes) - changes = [] - for change in changeset.changes: - uri = uris.from_fs_path(change.resource.path) - doc = workspace.get_maybe_document(uri) - changes.append( - { - "textDocument": {"uri": uri, "version": doc.version if doc else None}, - "edits": [ - { - "range": { - "start": {"line": 0, "character": 0}, - "end": { - "line": _num_lines(change.resource), - "character": 0, - }, - }, - "newText": change.new_contents, - } - ], - } - ) - return {"documentChanges": changes} - - -def _num_lines(resource): - "Count the number of lines in a `File` resource." - text = resource.read() - - if _utils.get_eol_chars(text): - return len(text.splitlines()) - return 0 diff --git a/external-deps/python-lsp-server/pylsp/python_lsp.py b/external-deps/python-lsp-server/pylsp/python_lsp.py index a3f737ac373..528ffdb4a85 100644 --- a/external-deps/python-lsp-server/pylsp/python_lsp.py +++ b/external-deps/python-lsp-server/pylsp/python_lsp.py @@ -9,7 +9,11 @@ from functools import partial from typing import Any, Dict, List -import ujson as json +try: + import ujson as json +except Exception: + import json + from pylsp_jsonrpc.dispatchers import MethodDispatcher from pylsp_jsonrpc.endpoint import Endpoint from pylsp_jsonrpc.streams import JsonRpcStreamReader, JsonRpcStreamWriter @@ -109,7 +113,7 @@ def start_ws_lang_server(port, check_parent_process, handler_class): import websockets except ImportError as e: raise ImportError( - "websocket modules missing. Please run pip install 'python-lsp-server[websockets]" + "websocket modules missing. Please run: pip install 'python-lsp-server[websockets]'" ) from e with ThreadPoolExecutor(max_workers=10) as tpool: diff --git a/external-deps/python-lsp-server/pylsp/uris.py b/external-deps/python-lsp-server/pylsp/uris.py index 45ad280b00b..cba5b2909d9 100644 --- a/external-deps/python-lsp-server/pylsp/uris.py +++ b/external-deps/python-lsp-server/pylsp/uris.py @@ -5,6 +5,7 @@ https://github.com/Microsoft/vscode-uri/blob/e59cab84f5df6265aed18ae5f43552d3eef13bb9/lib/index.ts """ + import re from urllib import parse diff --git a/external-deps/python-lsp-server/pyproject.toml b/external-deps/python-lsp-server/pyproject.toml index 4665dcbebf9..f68cc2ede00 100644 --- a/external-deps/python-lsp-server/pyproject.toml +++ b/external-deps/python-lsp-server/pyproject.toml @@ -33,7 +33,7 @@ all = [ "pycodestyle>=2.11.0,<2.12.0", "pydocstyle>=6.3.0,<6.4.0", "pyflakes>=3.2.0,<3.3.0", - "pylint>=2.5.0,<3.1", + "pylint>=3.1,<4", "rope>=1.11.0", "yapf>=0.33.0", "whatthepatch>=1.0.2,<2.0.0" @@ -44,12 +44,12 @@ mccabe = ["mccabe>=0.7.0,<0.8.0"] pycodestyle = ["pycodestyle>=2.11.0,<2.12.0"] pydocstyle = ["pydocstyle>=6.3.0,<6.4.0"] pyflakes = ["pyflakes>=3.2.0,<3.3.0"] -pylint = ["pylint>=2.5.0,<3.1"] +pylint = ["pylint>=3.1,<4"] rope = ["rope>=1.11.0"] yapf = ["yapf>=0.33.0", "whatthepatch>=1.0.2,<2.0.0"] websockets = ["websockets>=10.3"] test = [ - "pylint>=2.5.0,<3.1", + "pylint>=3.1,<4", "pytest", "pytest-cov", "coverage", @@ -79,7 +79,6 @@ pydocstyle = "pylsp.plugins.pydocstyle_lint" pyflakes = "pylsp.plugins.pyflakes_lint" pylint = "pylsp.plugins.pylint_lint" rope_completion = "pylsp.plugins.rope_completion" -rope_rename = "pylsp.plugins.rope_rename" rope_autoimport = "pylsp.plugins.rope_autoimport" yapf = "pylsp.plugins.yapf_format" diff --git a/external-deps/python-lsp-server/test/conftest.py b/external-deps/python-lsp-server/test/conftest.py index 5c4ab8f1fc0..a9010517994 100644 --- a/external-deps/python-lsp-server/test/conftest.py +++ b/external-deps/python-lsp-server/test/conftest.py @@ -1,7 +1,8 @@ # Copyright 2017-2020 Palantir Technologies, Inc. # Copyright 2021- Python Language Server Contributors. -""" py.test configuration""" +"""pytest configuration""" + import logging from pylsp.__main__ import LOG_FORMAT diff --git a/external-deps/python-lsp-server/test/plugins/test_autoimport.py b/external-deps/python-lsp-server/test/plugins/test_autoimport.py index 0d1e2d73e7b..4ac635ad5f1 100644 --- a/external-deps/python-lsp-server/test/plugins/test_autoimport.py +++ b/external-deps/python-lsp-server/test/plugins/test_autoimport.py @@ -313,7 +313,7 @@ def test_autoimport_code_actions_and_completions_for_notebook_document( ) assert rope_autoimport_settings.get("completions", {}).get("enabled", False) is True assert rope_autoimport_settings.get("memory", False) is True - wait_for_condition(lambda: not cache.thread.is_alive()) + wait_for_condition(lambda: not cache.is_blocked()) # 1. quick_fixes = server.code_actions("cell_1_uri", {}, make_context("os", 0, 0, 2)) diff --git a/external-deps/python-lsp-server/test/plugins/test_rope_rename.py b/external-deps/python-lsp-server/test/plugins/test_rope_rename.py deleted file mode 100644 index c55ead0adeb..00000000000 --- a/external-deps/python-lsp-server/test/plugins/test_rope_rename.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2017-2020 Palantir Technologies, Inc. -# Copyright 2021- Python Language Server Contributors. - -import os - -import pytest - -from pylsp import uris -from pylsp.plugins.rope_rename import pylsp_rename -from pylsp.workspace import Document - -DOC_NAME = "test1.py" -DOC = """class Test1(): - pass - -class Test2(Test1): - pass -""" - -DOC_NAME_SIMPLE = "test2.py" -DOC_SIMPLE = "foo = 12" - - -@pytest.fixture -def tmp_workspace(temp_workspace_factory): - return temp_workspace_factory({DOC_NAME: DOC, DOC_NAME_SIMPLE: DOC_SIMPLE}) - - -def test_rope_rename(tmp_workspace, config): - position = {"line": 0, "character": 6} - DOC_URI = uris.from_fs_path(os.path.join(tmp_workspace.root_path, DOC_NAME)) - doc = Document(DOC_URI, tmp_workspace) - - result = pylsp_rename(config, tmp_workspace, doc, position, "ShouldBeRenamed") - assert len(result.keys()) == 1 - - changes = result.get("documentChanges") - assert len(changes) == 1 - changes = changes[0] - - # Note that this test differs from test_jedi_rename, because rope does not - # seem to modify files that haven't been opened with textDocument/didOpen. - assert changes.get("edits") == [ - { - "range": { - "start": {"line": 0, "character": 0}, - "end": {"line": 5, "character": 0}, - }, - "newText": "class ShouldBeRenamed():\n pass\n\nclass Test2(ShouldBeRenamed):\n pass\n", - } - ] - - # Regression test for issue python-lsp/python-lsp-server#413 - # rename foo - position = {"line": 0, "character": 0} - DOC_URI = uris.from_fs_path(os.path.join(tmp_workspace.root_path, DOC_NAME_SIMPLE)) - doc = Document(DOC_URI, tmp_workspace) - - result = pylsp_rename(config, tmp_workspace, doc, position, "bar") - assert len(result.keys()) == 1 - - changes = result.get("documentChanges") - assert len(changes) == 1 - - assert changes[0].get("edits") == [ - { - "range": { - "start": {"line": 0, "character": 0}, - "end": {"line": 0, "character": 0}, - }, - "newText": "bar = 12", - } - ]