Skip to content

Commit

Permalink
test_buffer: don't depend on version-dependent default values of 'def…
Browse files Browse the repository at this point in the history
…ine'

`test_options` has an assertion that tests whether setting a local value
modifies the global value, but tests it against a hardcoded constant.

This constant changed in neovim/neovim@fcfe535

and
82a2e14
fixes it by using the new constant instead, but this causes tests to
fail against even the latest released version of neovim.

To make this version-agnostic, save the old global value, and assert
that the new value is equal after setting the local value.

Signed-off-by: Michel Alexandre Salim <[email protected]>
  • Loading branch information
michel-slm committed Jul 14, 2023
1 parent eaa862d commit 0734690
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ def test_options(vim: Nvim) -> None:
vim.current.buffer.options['shiftwidth'] = 4
assert vim.current.buffer.options['shiftwidth'] == 4
# global-local option
global_define = vim.options['define']
vim.current.buffer.options['define'] = 'test'
assert vim.current.buffer.options['define'] == 'test'
# Doesn't change the global value
assert vim.options['define'] == ''
assert vim.options['define'] == global_define

with pytest.raises(KeyError) as excinfo:
vim.current.buffer.options['doesnotexist']
Expand Down

0 comments on commit 0734690

Please sign in to comment.