Skip to content

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Oct 20, 2023

Uses the long ruff version if supported by the binary.

Useful for testing e.g. #286 and astral-sh/ruff#8016

❯ pytest
======================================================================================================================================================= test session starts ========================================================================================================================================================
platform darwin -- Python 3.7.17, pytest-7.4.2, pluggy-1.2.0
ruff-version: 0.1.1+15 (860ffb954 2023-10-20)
rootdir: /Users/mz/eng/src/astral-sh/ruff-lsp
configfile: pyproject.toml
plugins: typeguard-3.0.2, asyncio-0.21.1, anyio-3.7.1
asyncio: mode=strict
collected 3 items                                                                                                                                                                                                                                                                                                                  

tests/test_format.py .                                                                                                                                                                                                                                                                                                       [ 33%]
tests/test_server.py ..                                                                                                                                                                                                                                                                                                      [100%]

======================================================================================================================================================== 3 passed in 0.68s =========================================================================================================================================================

@zanieb zanieb force-pushed the zanie/show-version branch from 661c08f to 326f487 Compare October 20, 2023 20:20
@zanieb zanieb requested a review from charliermarsh October 21, 2023 15:07
Comment on lines +34 to +40
# Display the long version if the executable supports it
try:
output = subprocess.check_output([executable.path, "version"]).decode().strip()
except subprocess.CalledProcessError:
output = (
subprocess.check_output([executable.path, "--version"]).decode().strip()
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this instead of simply executable.version so we can get richer information when available.

@zanieb zanieb merged commit 88c7379 into main Oct 23, 2023
@zanieb zanieb deleted the zanie/show-version branch October 23, 2023 14:04
zanieb added a commit to astral-sh/ruff that referenced this pull request Oct 23, 2023
Adds a CI job which runs `ruff-lsp` tests against the current Ruff
build.

Avoids rebuilding Ruff at the cost of running _after_ the cargo tests
have finished. Might be worth the rebuild to get earlier feedback but I
don't expect it to fail often?

xref astral-sh/ruff-lsp#286

## Test plan

Verified use of the development version by inspecting version output in
CI; supported by astral-sh/ruff-lsp#289 and
#8034
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants