Skip to content

Commit a2e1169

Browse files
brcolowjustinmk
authored andcommitted
win: Fix failing tests. (#201)
- test_vim.test_command: close the file before unlink(). - test_vim.test_chdir was failing for two reasons. First because of missing Windows-specific handling of path names in find_file_in_path_option in file_search.c in Neovim core (neovim/neovim#4711). Second because although `:cd /` works, getcwd() prepends the drive-letter. Closes #166
1 parent ca3551d commit a2e1169

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/test_vim.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def test_command():
2121
vim.command('normal itesting\npython\napi')
2222
vim.command('w')
2323
ok(os.path.isfile(fname))
24-
eq(open(fname).read(), 'testing\npython\napi\n')
24+
with open(fname) as f:
25+
eq(f.read(), 'testing\npython\napi\n')
2526
os.unlink(fname)
2627

2728

@@ -63,8 +64,10 @@ def test_strwidth():
6364
@with_setup(setup=cleanup)
6465
def test_chdir():
6566
pwd = vim.eval('getcwd()')
67+
root = os.path.abspath(os.sep)
68+
# We can chdir to '/' on Windows, but then the pwd will be the root drive
6669
vim.chdir('/')
67-
eq(vim.eval('getcwd()'), '/')
70+
eq(vim.eval('getcwd()'), root)
6871
vim.chdir(pwd)
6972
eq(vim.eval('getcwd()'), pwd)
7073

0 commit comments

Comments
 (0)