mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
[python/pyre.vim] use pyrefly executable (#4972)
https://github.com/facebook/pyrefly The pyre project has evolved to pyrefly. This replaces the pyre linter with a pyrefly one and removes the test files that were added for finding the project root in the old pyre world. Co-authored-by: Oliver Ruben Albertini <oliverruben@gmail.com>
This commit is contained in:
69
test/linter/test_pyrefly.vader
Normal file
69
test/linter/test_pyrefly.vader
Normal file
@@ -0,0 +1,69 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('python', 'pyrefly')
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
|
||||
After:
|
||||
unlet! b:bin_dir
|
||||
unlet! b:executable
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The pyrefly command callback should return default string):
|
||||
call ale#test#SetFilename('./foo.py')
|
||||
|
||||
AssertLinter 'pyrefly', ale#Escape('pyrefly') . ' lsp'
|
||||
|
||||
Execute(The pyrefly executable should be configurable):
|
||||
let g:ale_python_pyrefly_executable = '~/.local/bin/pyrefly'
|
||||
|
||||
AssertLinter '~/.local/bin/pyrefly',
|
||||
\ ale#Escape('~/.local/bin/pyrefly') . ' lsp'
|
||||
|
||||
Execute(The pyrefly executable should be run from the virtualenv path):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pyrefly'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' lsp'
|
||||
|
||||
Execute(You should be able to override the pyrefly virtualenv lookup):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
let g:ale_python_pyrefly_use_global = 1
|
||||
|
||||
AssertLinter 'pyrefly', ale#Escape('pyrefly') . ' lsp'
|
||||
|
||||
Execute(Setting executable to 'pipenv' appends 'run pyrefly'):
|
||||
let g:ale_python_pyrefly_executable = 'path/to/pipenv'
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#Escape('path/to/pipenv') . ' run pyrefly lsp'
|
||||
|
||||
Execute(Pipenv is detected when python_pyrefly_auto_pipenv is set):
|
||||
let g:ale_python_pyrefly_auto_pipenv = 1
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#Escape('pipenv') . ' run pyrefly lsp'
|
||||
|
||||
Execute(Setting executable to 'poetry' appends 'run pyrefly lsp'):
|
||||
let g:ale_python_pyrefly_executable = 'path/to/poetry'
|
||||
|
||||
AssertLinter 'path/to/poetry',
|
||||
\ ale#Escape('path/to/poetry') . ' run pyrefly lsp'
|
||||
|
||||
Execute(Poetry is detected when python_pyrefly_auto_poetry is set):
|
||||
let g:ale_python_pyrefly_auto_poetry = 1
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pyrefly lsp'
|
||||
|
||||
Execute(uv is detected when python_pyrefly_auto_uv is set):
|
||||
let g:ale_python_pyrefly_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pyrefly lsp'
|
||||
Reference in New Issue
Block a user