tests: Catch vim errors in read_buffer

Without this, TestInfoActionNotTriggeredByEnterOnLink would pass because
it asserts that the buffer is empty, which is what read_buffer returned
if vim was stuck showing an error message. With `PYTEST_FLAGS=-s`, it
would additionally log

    E449: Invalid expression received: Send expression failed.

but that's easy to miss.
This commit is contained in:
Tomas Janousek 2020-06-28 23:37:01 +02:00 committed by Tomas Babej
parent 9457b509cf
commit 789d04f488

View file

@ -32,9 +32,15 @@ class IntegrationTest(object):
assert result == u"0"
def read_buffer(self, start=0, end=1000):
# ensure that vim isn't stuck stuck showing an error message
# (read_buffer would ignore this and just return '')
buf = self.client.get_active_buffer()
assert buf
return self.client.read_buffer(
six.text_type(start+1),
six.text_type(end+1)
six.text_type(end+1),
buf=buf
).splitlines()
def generate_data(self):