Skip to content

Commit d852572

Browse files
committed
ci: Add python3.12 support
neovim's python3 provider detection has a bug on python3.12 (neovim/neovim#25316), so we work around this by explicitly setting the `g:python3_host_prog` variable. Also, pynvim on python3.12 requires greenlet 3.x. Fixes #528
1 parent f244597 commit d852572

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
cache: 'pip'
2323
python-version: 3.11
2424
- name: install dependencies
25-
run: pip install tox tox-gh-actions
25+
run: python3 -m pip install tox tox-gh-actions
2626
- name: checkqa
2727
env:
2828
TOXENV: 'checkqa,docs'
@@ -71,11 +71,13 @@ jobs:
7171
run: echo "$(pwd)/${{ matrix.NVIM_BIN_PATH }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
7272

7373
- name: install dependencies
74-
run: pip install tox tox-gh-actions
74+
run: python3 -m pip install tox tox-gh-actions
7575

76-
- name: test
76+
- name: test with tox
7777
run: |
7878
echo $PATH
7979
which nvim
8080
nvim --version
81+
which -a python3
82+
python3 --version
8183
tox

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424

2525
if platform.python_implementation() != 'PyPy':
2626
# pypy already includes an implementation of the greenlet module
27-
install_requires.append('greenlet')
27+
if sys.version_info >= (3, 12):
28+
install_requires.append('greenlet>=3.0.0rc3')
29+
else:
30+
install_requires.append('greenlet')
2831

2932
if sys.version_info < (3, 8):
3033
install_requires.append('typing-extensions')

test/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ def vim() -> pynvim.Nvim:
1313
child_argv = os.environ.get('NVIM_CHILD_ARGV')
1414
listen_address = os.environ.get('NVIM_LISTEN_ADDRESS')
1515
if child_argv is None and listen_address is None:
16-
child_argv = '["nvim", "-u", "NONE", "--embed", "--headless"]'
16+
child_argv = json.dumps([
17+
"nvim", "-u", "NONE", "--embed", "--headless",
18+
"-c", "let g:python3_host_prog='python3'", # workaround neovim/neovim#25316
19+
])
1720

1821
if child_argv is not None:
1922
editor = pynvim.attach('child', argv=json.loads(child_argv))

test/test_vim.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ def test_hash(vim: Nvim) -> None:
197197
assert d[vim.current.buffer] == 'beta'
198198

199199

200-
def test_cwd(vim: Nvim, tmpdir: Any) -> None:
200+
def test_python3(vim: Nvim, tmpdir: Any) -> None:
201+
python3_prog = vim.command_output('echom provider#python3#Prog()')
202+
python3_err = vim.command_output('echom provider#python3#Error()')
203+
assert python3_prog != "", python3_err
204+
201205
vim.command('python3 import os')
202206
cwd_before = vim.command_output('python3 print(os.getcwd())')
203207

0 commit comments

Comments
 (0)