From 95c3ab2454ffea2afdc944b9e82e184922aebdc5 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 26 May 2020 11:13:54 +0200 Subject: [PATCH] skip yamllint test if yamllint is not installed !721 --- tests/common.TestCase | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/common.TestCase b/tests/common.TestCase index 93fbedd3..4dc51e5c 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -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('''\