mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-30 14:45:29 +08:00
Improve support for python package manage: pipenv, poetry and uv (#4825)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
This commit is contained in:
committed by
GitHub
parent
954682108d
commit
a7ef1817b7
@@ -18,22 +18,6 @@ After:
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The autoflake callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ 0,
|
||||
\ ale#fixers#autoflake#Fix(bufnr(''))
|
||||
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoflake'))
|
||||
\ . ' --in-place '
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ },
|
||||
\ ale#fixers#autoflake#Fix(bufnr(''))
|
||||
|
||||
|
||||
Execute(The autoflake callback should include options):
|
||||
let g:ale_python_autoflake_options = '--some-option'
|
||||
|
||||
@@ -47,3 +31,39 @@ Execute(The autoflake callback should include options):
|
||||
\ 'read_temporary_file': 1,
|
||||
\ },
|
||||
\ ale#fixers#autoflake#Fix(bufnr(''))
|
||||
|
||||
Execute(pipenv is detected when python_autoflake_auto_pipenv is set):
|
||||
let g:ale_python_autoflake_auto_pipenv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('pipenv') . ' run autoflake --in-place %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ },
|
||||
\ ale#fixers#autoflake#Fix(bufnr(''))
|
||||
|
||||
Execute(Poetry is detected when python_autoflake_auto_poetry is set):
|
||||
let g:ale_python_autoflake_auto_poetry = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('poetry') . ' run autoflake --in-place %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ },
|
||||
\ ale#fixers#autoflake#Fix(bufnr(''))
|
||||
|
||||
Execute(uv is detected when python_autoflake_auto_uv is set):
|
||||
let g:ale_python_autoflake_auto_uv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('uv') . ' run autoflake --in-place %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ },
|
||||
\ ale#fixers#autoflake#Fix(bufnr(''))
|
||||
|
||||
@@ -18,11 +18,8 @@ After:
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The autoimport callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ 0,
|
||||
\ ale#fixers#autoimport#Fix(bufnr(''))
|
||||
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
@@ -33,11 +30,8 @@ Execute(The autoimport callback should return the correct default values):
|
||||
Execute(The autoimport callback should respect custom options):
|
||||
let g:ale_python_autoimport_options = '--multi-line=3 --trailing-comma'
|
||||
|
||||
AssertEqual
|
||||
\ 0,
|
||||
\ ale#fixers#autoimport#Fix(bufnr(''))
|
||||
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
@@ -45,3 +39,39 @@ Execute(The autoimport callback should respect custom options):
|
||||
\ . ' --multi-line=3 --trailing-comma -',
|
||||
\ },
|
||||
\ ale#fixers#autoimport#Fix(bufnr(''))
|
||||
|
||||
Execute(pipenv is detected when python_autoimport_auto_pipenv is set):
|
||||
let g:ale_python_autoimport_auto_pipenv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape('pipenv') . ' run autoimport -',
|
||||
\ },
|
||||
\ ale#fixers#autoimport#Fix(bufnr(''))
|
||||
|
||||
Execute(Poetry is detected when python_autoimport_auto_poetry is set):
|
||||
let g:ale_python_autoimport_auto_poetry = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape('poetry') . ' run autoimport -',
|
||||
\ },
|
||||
\ ale#fixers#autoimport#Fix(bufnr(''))
|
||||
|
||||
Execute(uv is detected when python_autoimport_auto_uv is set):
|
||||
let g:ale_python_autoimport_auto_uv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape('uv') . ' run autoimport -',
|
||||
\ },
|
||||
\ ale#fixers#autoimport#Fix(bufnr(''))
|
||||
|
||||
@@ -19,11 +19,8 @@ After:
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The autopep8 callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ 0,
|
||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'},
|
||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||
@@ -32,6 +29,40 @@ Execute(The autopep8 callback should include options):
|
||||
let g:ale_python_autopep8_options = '--some-option'
|
||||
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' },
|
||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||
|
||||
Execute(pipenv is detected when python_autopep8_auto_pipenv is set):
|
||||
let g:ale_python_autopep8_auto_pipenv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('pipenv') . ' run autopep8 -',
|
||||
\ },
|
||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||
|
||||
Execute(Poetry is detected when python_autopep8_auto_poetry is set):
|
||||
let g:ale_python_autopep8_auto_poetry = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('poetry') . ' run autopep8 -',
|
||||
\ },
|
||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||
|
||||
Execute(uv is detected when python_autopep8_auto_uv is set):
|
||||
let g:ale_python_autopep8_auto_uv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('uv') . ' run autopep8 -',
|
||||
\ },
|
||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||
|
||||
@@ -65,3 +65,13 @@ Execute(Poetry is detected when python_black_auto_poetry is set):
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('poetry') . ' run black -'},
|
||||
\ ale#fixers#black#Fix(bufnr(''))
|
||||
|
||||
Execute(uv is detected when python_black_auto_uv is set):
|
||||
let g:ale_python_black_auto_uv = 1
|
||||
let g:ale_python_black_change_directory = 0
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('uv') . ' run black -'},
|
||||
\ ale#fixers#black#Fix(bufnr(''))
|
||||
|
||||
@@ -58,6 +58,19 @@ Execute(Poetry is detected when python_isort_auto_poetry is set):
|
||||
\ 'command': ale#Escape('poetry') . ' run isort' . ' --filename %s' . ' -'
|
||||
\ }
|
||||
|
||||
Execute(uv is detected when python_isort_auto_uv is set):
|
||||
let g:ale_python_isort_auto_uv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
GivenCommandOutput ['VERSION 5.7.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape('uv') . ' run isort' . ' --filename %s' . ' -'
|
||||
\ }
|
||||
|
||||
|
||||
Execute(The isort callback should not use --filename for older versions):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
|
||||
@@ -106,6 +106,19 @@ Execute(Poetry is detected when python_pycln_auto_poetry is set, and cwd respect
|
||||
\ 'command': ale#Escape('poetry') . ' run pycln' . b:cmd_tail . ' -'
|
||||
\ }
|
||||
|
||||
Execute(uv is detected when python_pycln_auto_uv is set):
|
||||
let g:ale_python_pycln_auto_uv = 1
|
||||
let g:ale_python_pycln_change_directory = 0
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
GivenCommandOutput ['pycln, version 1.3.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape('uv') . ' run pycln' . b:cmd_tail . ' -'
|
||||
\ }
|
||||
|
||||
Execute(configuration files set in _config should be supported):
|
||||
let g:ale_python_pycln_change_directory = 0
|
||||
let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')
|
||||
|
||||
@@ -36,3 +36,14 @@ Execute(Poetry is detected when python_pyflyby_auto_poetry is set):
|
||||
\ {
|
||||
\ 'command': ale#Escape('poetry') . ' run tidy-imports'
|
||||
\ }
|
||||
|
||||
Execute(uv is detected when python_pyflyby_auto_uv is set):
|
||||
let g:ale_python_pyflyby_auto_uv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
GivenCommandOutput ['VERSION 5.7.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape('uv') . ' run tidy-imports'
|
||||
\ }
|
||||
|
||||
@@ -18,11 +18,8 @@ After:
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The reorder_python_imports callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ 0,
|
||||
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
|
||||
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/'
|
||||
@@ -33,14 +30,44 @@ Execute(The reorder_python_imports callback should return the correct default va
|
||||
Execute(The reorder_python_imports callback should respect custom options):
|
||||
let g:ale_python_reorder_python_imports_options = '--py3-plus'
|
||||
|
||||
AssertEqual
|
||||
\ 0,
|
||||
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
|
||||
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/'
|
||||
\ . b:bin_dir . '/reorder-python-imports')) . ' --py3-plus -',
|
||||
\ },
|
||||
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
|
||||
|
||||
Execute(pipenv is detected when python_reorder_python_imports_auto_pipenv is set):
|
||||
let g:ale_python_reorder_python_imports_auto_pipenv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('pipenv') . ' run reorder-python-imports -',
|
||||
\ },
|
||||
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
|
||||
|
||||
Execute(Poetry is detected when python_reorder_python_imports_auto_poetry is set):
|
||||
let g:ale_python_reorder_python_imports_auto_poetry = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('poetry') . ' run reorder-python-imports -',
|
||||
\ },
|
||||
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
|
||||
|
||||
Execute(uv is detected when python_reorder_python_imports_auto_uv is set):
|
||||
let g:ale_python_reorder_python_imports_auto_uv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('uv') . ' run reorder-python-imports -',
|
||||
\ },
|
||||
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
|
||||
|
||||
@@ -134,3 +134,17 @@ Execute(Poetry is detected when python_ruff_auto_poetry is set, and cwd respects
|
||||
\ 'command': ale#Escape('poetry') . ' run ruff --stdin-filename ' . fname . ' --fix -'
|
||||
\ }
|
||||
|
||||
Execute(uv is detected when python_ruff_auto_uv is set):
|
||||
let g:ale_python_ruff_auto_uv = 1
|
||||
let g:ale_python_ruff_change_directory = 0
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
let fname = ale#Escape(ale#path#Simplify(g:dir .'/../test-files/python/uv/whatever.py'))
|
||||
|
||||
GivenCommandOutput ['ruff 0.0.72']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape('uv') . ' run ruff --stdin-filename ' . fname . ' --fix -'
|
||||
\ }
|
||||
|
||||
@@ -84,3 +84,16 @@ Execute(Poetry is detected when python_ruff_format_auto_poetry is set, and cwd r
|
||||
\ 'command': ale#Escape('poetry') . ' run ruff format --stdin-filename ' . fname . ' -'
|
||||
\ }
|
||||
|
||||
Execute(uv is detected when python_ruff_format_auto_uv is set):
|
||||
let g:ale_python_ruff_format_auto_uv = 1
|
||||
let g:ale_python_ruff_format_change_directory = 0
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
let fname = ale#Escape(ale#path#Simplify(g:dir .'/../test-files/python/uv/whatever.py'))
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape('uv') . ' run ruff format --stdin-filename ' . fname . ' -'
|
||||
\ }
|
||||
|
||||
@@ -15,17 +15,6 @@ After:
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The yapf callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ 0,
|
||||
\ ale#fixers#yapf#Fix(bufnr(''))
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yapf'))},
|
||||
\ ale#fixers#yapf#Fix(bufnr(''))
|
||||
\
|
||||
Execute(The yapf should include the .style.yapf file if present):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/dir_with_yapf_config/foo/bar.py')
|
||||
|
||||
@@ -37,3 +26,36 @@ Execute(The yapf should include the .style.yapf file if present):
|
||||
\ . ' --style ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/dir_with_yapf_config/.style.yapf')),
|
||||
\ },
|
||||
\ ale#fixers#yapf#Fix(bufnr(''))
|
||||
|
||||
Execute(pipenv is detected when python_yapf_auto_pipenv is set):
|
||||
let g:ale_python_yapf_auto_pipenv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('pipenv') . ' run yapf',
|
||||
\ },
|
||||
\ ale#fixers#yapf#Fix(bufnr(''))
|
||||
|
||||
Execute(Poetry is detected when python_yapf_auto_poetry is set):
|
||||
let g:ale_python_yapf_auto_poetry = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('poetry') . ' run yapf',
|
||||
\ },
|
||||
\ ale#fixers#yapf#Fix(bufnr(''))
|
||||
|
||||
Execute(uv is detected when python_yapf_auto_uv is set):
|
||||
let g:ale_python_yapf_auto_uv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('uv') . ' run yapf',
|
||||
\ },
|
||||
\ ale#fixers#yapf#Fix(bufnr(''))
|
||||
|
||||
@@ -67,6 +67,16 @@ Execute(Poetry is detected when python_bandit_auto_poetry is set):
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(uv is used when python_bandit_auto_uv is set):
|
||||
let g:ale_python_bandit_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv')
|
||||
\ . ' run bandit'
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(The bandit command callback should add .bandit by default):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/namespace/foo/bar.py')
|
||||
|
||||
|
||||
@@ -217,3 +217,10 @@ Execute(poetry is detected when python_flake8_auto_poetry is set):
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run flake8 --format=default --stdin-display-name %s -'
|
||||
|
||||
Execute(uv is detected when python_flake8_auto_uv is set):
|
||||
let g:ale_python_flake8_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run flake8 --format=default --stdin-display-name %s -'
|
||||
|
||||
@@ -201,3 +201,10 @@ Execute(poetry is detected when python_flakehell_auto_poetry is set):
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run flakehell lint --format=default --stdin-display-name %s -'
|
||||
|
||||
Execute(uv is detected when python_flakehell_auto_uv is set):
|
||||
let g:ale_python_flakehell_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run flakehell lint --format=default --stdin-display-name %s -'
|
||||
|
||||
@@ -47,3 +47,17 @@ Execute(Setting executable to 'pipenv' appends 'run jedi-language-server'):
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run jedi-language-server'
|
||||
|
||||
Execute(poetry is detected when python_jedils_auto_poetry is set):
|
||||
let g:ale_python_jedils_auto_poetry = 1
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run jedi-language-server'
|
||||
|
||||
Execute(uv is detected when python_jedils_auto_uv is set):
|
||||
let g:ale_python_jedils_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run jedi-language-server'
|
||||
|
||||
@@ -104,3 +104,11 @@ Execute(Poetry is detected when python_mypy_auto_poetry is set):
|
||||
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
|
||||
|
||||
Execute(uv is detected when python_mypy_auto_uv is set):
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
let g:ale_python_mypy_auto_uv = 1
|
||||
|
||||
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
|
||||
|
||||
@@ -33,3 +33,11 @@ Execute(Poetry is detected when python_prospector_auto_poetry is set):
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run prospector'
|
||||
\ . ' --messages-only --absolute-paths --zero-exit --output-format json %s'
|
||||
|
||||
Execute(uv is detected when python_prospector_auto_uv is set):
|
||||
let g:ale_python_prospector_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run prospector'
|
||||
\ . ' --messages-only --absolute-paths --zero-exit --output-format json %s'
|
||||
|
||||
@@ -97,6 +97,14 @@ Execute(poetry is detected when python_pycln_auto_poetry is set):
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run pycln'
|
||||
\ . b:cmd_tail
|
||||
|
||||
Execute(uv is detected when python_pycln_auto_uv is set):
|
||||
let g:ale_python_pycln_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run pycln'
|
||||
\ . b:cmd_tail
|
||||
|
||||
Execute(configuration files set in _config should be supported):
|
||||
let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')
|
||||
|
||||
|
||||
@@ -44,3 +44,10 @@ Execute(Poetry is detected when python_pycodestyle_auto_poetry is set):
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pycodestyle -'
|
||||
|
||||
Execute(uv is detected when python_pycodestyle_auto_uv is set):
|
||||
let g:ale_python_pycodestyle_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pycodestyle -'
|
||||
|
||||
@@ -43,3 +43,9 @@ Execute(Poetry is detected when python_pydocstyle_auto_poetry is set):
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run pydocstyle %s'
|
||||
|
||||
Execute(uv is detected when python_pydocstyle_auto_uv is set):
|
||||
let g:ale_python_pydocstyle_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run pydocstyle %s'
|
||||
|
||||
@@ -58,3 +58,10 @@ Execute(Poetry is detected when python_pyflakes_auto_poetry is set):
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pyflakes %t'
|
||||
|
||||
Execute(uv is detected when python_pyflakes_auto_uv is set):
|
||||
let g:ale_python_pyflakes_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pyflakes %t'
|
||||
|
||||
@@ -86,3 +86,9 @@ Execute(poetry is detected when python_pylama_auto_poetry is set):
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run pylama' . b:command_tail
|
||||
|
||||
Execute(uv is detected when python_pylama_auto_uv is set):
|
||||
let g:ale_python_pylama_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run pylama' . b:command_tail
|
||||
|
||||
@@ -94,3 +94,11 @@ Execute(poetry is detected when python_pylint_auto_poetry is set):
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run pylint'
|
||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
||||
|
||||
Execute(uv is detected when python_pylint_auto_uv is set):
|
||||
let g:ale_python_pylint_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run pylint'
|
||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
||||
|
||||
@@ -85,6 +85,13 @@ Execute(poetry is detected when python_pylsp_auto_poetry is set):
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pylsp'
|
||||
|
||||
Execute(uv is detected when python_pylsp_auto_uv is set):
|
||||
let g:ale_python_pylsp_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pylsp'
|
||||
|
||||
Execute(Should accept configuration settings):
|
||||
AssertLSPConfig {}
|
||||
let b:ale_python_pylsp_config = {'pylsp': {'plugins': {'preload': {'enabled': v:false}}}}
|
||||
|
||||
@@ -61,6 +61,13 @@ Execute(Poetry is detected when python_pyre_auto_poetry is set):
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pyre persistent'
|
||||
|
||||
Execute(uv is detected when python_pyre_auto_uv is set):
|
||||
let g:ale_python_pyre_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pyre persistent'
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via .pyre_configuration.local):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/pyre_configuration_dir/foo/bar.py')
|
||||
|
||||
|
||||
@@ -179,3 +179,10 @@ Execute(poetry is detected when python_pyright_auto_poetry is set):
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pyright-langserver --stdio'
|
||||
|
||||
Execute(uv is detected when python_pyright_auto_uv is set):
|
||||
let g:ale_python_pyright_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pyright-langserver --stdio'
|
||||
|
||||
@@ -83,3 +83,10 @@ Execute(poetry is detected when python_refurb_auto_poetry is set):
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run refurb %s'
|
||||
|
||||
Execute(uv is detected when python_refurb_auto_uv is set):
|
||||
let g:ale_python_refurb_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run refurb %s'
|
||||
|
||||
@@ -117,3 +117,11 @@ Execute(poetry is detected when python_ruff_auto_poetry is set):
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run ruff -q --no-fix'
|
||||
\ . b:command_tail
|
||||
|
||||
Execute(uv is detected when python_ruff_auto_uv is set):
|
||||
let g:ale_python_ruff_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run ruff -q --no-fix'
|
||||
\ . b:command_tail
|
||||
|
||||
@@ -69,3 +69,10 @@ Execute(Poetry is detected when python_unimport_auto_poetry is set):
|
||||
|
||||
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run unimport --check %t'
|
||||
|
||||
Execute(uv is detected when python_unimport_auto_uv is set):
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
let g:ale_python_unimport_auto_uv = 1
|
||||
|
||||
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run unimport --check %t'
|
||||
|
||||
@@ -61,3 +61,25 @@ Execute(Setting executable to 'poetry' appends 'run vulture'):
|
||||
let g:ale_python_vulture_executable = 'path/to/poetry'
|
||||
|
||||
AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run vulture' . ' .'
|
||||
|
||||
Execute(pipenv is detected when python_vulture_auto_pipenv is set):
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
let g:ale_python_vulture_auto_pipenv = 1
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#Escape('pipenv') . ' run vulture' . ' .'
|
||||
|
||||
|
||||
Execute(poetry is detected when python_vulture_auto_poetry is set):
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
let g:ale_python_vulture_auto_poetry = 1
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run vulture' . ' .'
|
||||
|
||||
Execute(uv is detected when python_vulture_auto_uv is set):
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
let g:ale_python_vulture_auto_uv = 1
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run vulture' . ' .'
|
||||
|
||||
0
test/test-files/python/uv/.gitkeep
Normal file
0
test/test-files/python/uv/.gitkeep
Normal file
0
test/test-files/python/uv/uv.lock
generated
Normal file
0
test/test-files/python/uv/uv.lock
generated
Normal file
0
test/test-files/python/uv/whatever.py
Normal file
0
test/test-files/python/uv/whatever.py
Normal file
19
test/test_python_uv.vader
Normal file
19
test/test_python_uv.vader
Normal file
@@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
|
||||
After:
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(ale#python#UvPresent is true when a uv environment is present):
|
||||
call ale#test#SetFilename('test-files/python/uv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#python#UvPresent(bufnr('%')),
|
||||
\ 1
|
||||
|
||||
Execute(ale#python#UvPresent is false when no uv environment is present):
|
||||
call ale#test#SetFilename('test-files/python/no_uv/whatever.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#python#UvPresent(bufnr('%')),
|
||||
\ 0
|
||||
Reference in New Issue
Block a user