From 510b1c94e48b226b5ede11b716441ae064fc997e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 15 Jan 2018 08:38:36 +0100 Subject: [PATCH] Improve tests / failure detection (#769) --- conftest.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/conftest.py b/conftest.py index 57e9857..ffb6c8e 100644 --- a/conftest.py +++ b/conftest.py @@ -19,10 +19,18 @@ class IntegrationTestFile(object): def run(self): output = subprocess.check_output( [VSPEC_RUNNER, '.', VSPEC_FOLDER, self.path]) + had_ok = False for line in output.splitlines(): - if line.startswith(b'not ok') or line.startswith(b'Error'): + if (line.startswith(b'not ok') or + line.startswith(b'Error') or + line.startswith(b'Bail out!')): pytest.fail("{0} failed:\n{1}".format( self.path, output.decode('utf-8')), pytrace=False) + if not had_ok and line.startswith(b'ok'): + had_ok = True + if not had_ok: + pytest.fail("{0} failed: no 'ok' found:\n{1}".format( + self.path, output.decode('utf-8')), pytrace=False) @property def name(self): @@ -60,7 +68,7 @@ def pytest_generate_tests(metafunc): """ def collect_tests(): for f in os.listdir(TEST_DIR): - if f.endswith('.vim'): + if f.endswith('.vim') and f != 'utils.vim': yield IntegrationTestFile(os.path.join(TEST_DIR, f)) tests = list(collect_tests())