2
0
mirror of https://github.com/mhinz/neovim-remote synced 2024-11-11 13:10:34 +00:00

Tests: add first pytest

This commit is contained in:
Marco Hinz 2017-05-24 20:42:21 +02:00
parent 39519a7b00
commit 1bcc77e299
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

21
tests/test_nvr.py Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
import os
import time
import signal
import subprocess
import nvr
def test_open_and_write_file():
env = {'NVIM_LISTEN_ADDRESS': '/tmp/pytest_nvimsock'}
env.update(os.environ)
with subprocess.Popen(['nvim', '-nu', 'NORC', '--headless'], close_fds=True,
env=env) as proc:
time.sleep(1)
argv = ['nvr', '-c', 'e /tmp/pytest_file | %d | exe "norm! iabc" | w']
nvr.main(argv=argv, env=env)
proc.send_signal(signal.SIGTERM)
with open('/tmp/pytest_file') as f:
assert 'abc\n' == f.read()