forked from VimPlug/jedi-vim
Improve tests / failure detection (#769)
This commit is contained in:
committed by
Dave Halter
parent
6d05c25873
commit
510b1c94e4
12
conftest.py
12
conftest.py
@@ -19,10 +19,18 @@ class IntegrationTestFile(object):
|
|||||||
def run(self):
|
def run(self):
|
||||||
output = subprocess.check_output(
|
output = subprocess.check_output(
|
||||||
[VSPEC_RUNNER, '.', VSPEC_FOLDER, self.path])
|
[VSPEC_RUNNER, '.', VSPEC_FOLDER, self.path])
|
||||||
|
had_ok = False
|
||||||
for line in output.splitlines():
|
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(
|
pytest.fail("{0} failed:\n{1}".format(
|
||||||
self.path, output.decode('utf-8')), pytrace=False)
|
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
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
@@ -60,7 +68,7 @@ def pytest_generate_tests(metafunc):
|
|||||||
"""
|
"""
|
||||||
def collect_tests():
|
def collect_tests():
|
||||||
for f in os.listdir(TEST_DIR):
|
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))
|
yield IntegrationTestFile(os.path.join(TEST_DIR, f))
|
||||||
|
|
||||||
tests = list(collect_tests())
|
tests = list(collect_tests())
|
||||||
|
|||||||
Reference in New Issue
Block a user