From b1b38cc77d3f09e2964a41b4ed810e00a038b6c9 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 24 Dec 2015 18:54:39 +0100 Subject: [PATCH] [test] Skip `errors` tests if there is not any --- test/test_chordpro/test_parser.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/test_chordpro/test_parser.py b/test/test_chordpro/test_parser.py index 01967233..0689adcf 100644 --- a/test/test_chordpro/test_parser.py +++ b/test/test_chordpro/test_parser.py @@ -91,14 +91,15 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): cls._create_test(base, in_format, out_format), ) - with cls.chdir('errors'): - for source in sorted(glob.glob('*.*.source')): - [*base, in_format, _] = source.split('.') - base = '.'.join(base) - yield ( - "test_{}_{}_failure".format(base, in_format), - cls._create_failure(base, in_format), - ) + if os.path.isdir("errors"): + with cls.chdir('errors'): + for source in sorted(glob.glob('*.*.source')): + [*base, in_format, _] = source.split('.') + base = '.'.join(base) + yield ( + "test_{}_{}_failure".format(base, in_format), + cls._create_failure(base, in_format), + ) @classmethod def _create_test(cls, base, in_format, out_format):