Skip to content

Commit 5be54e2

Browse files
authored
test_buffer: don't depend on version-dependent default values #531
`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 <salimma@fedoraproject.org>
1 parent 3c5d91a commit 5be54e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/test_buffer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ def test_options(vim: Nvim) -> None:
103103
vim.current.buffer.options['shiftwidth'] = 4
104104
assert vim.current.buffer.options['shiftwidth'] == 4
105105
# global-local option
106+
global_define = vim.options['define']
106107
vim.current.buffer.options['define'] = 'test'
107108
assert vim.current.buffer.options['define'] == 'test'
108109
# Doesn't change the global value
109-
assert vim.options['define'] == ''
110+
assert vim.options['define'] == global_define
110111

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

0 commit comments

Comments
 (0)