skip yamllint test if yamllint is not installed

!721
This commit is contained in:
Hans-Christoph Steiner 2020-05-26 11:13:54 +02:00
parent 6030445be0
commit 95c3ab2454
1 changed files with 10 additions and 0 deletions

View File

@ -1315,6 +1315,11 @@ class CommonTest(unittest.TestCase):
self.assertEqual(ret, ('ACRA', None, 'srclib/ACRA'))
def test_run_yamllint_wellformed(self):
try:
import yamllint.config
yamllint.config # make pyflakes ignore this
except ImportError:
self.skipTest('yamllint not installed')
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
with open('wellformed.yml', 'w') as f:
f.write(textwrap.dedent('''\
@ -1328,6 +1333,11 @@ class CommonTest(unittest.TestCase):
self.assertEqual(result, '')
def test_run_yamllint_malformed(self):
try:
import yamllint.config
yamllint.config # make pyflakes ignore this
except ImportError:
self.skipTest('yamllint not installed')
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
with open('malformed.yml', 'w') as f:
f.write(textwrap.dedent('''\