Find Yaml tests recursively

This commit is contained in:
Honza Kral
2013-07-10 13:02:15 +02:00
parent 0940d2a5d6
commit f1b4eec524
@@ -3,7 +3,7 @@ Dynamically generated set of TestCases based on set of yaml files decribing
some integration tests. These files are shared among all official Elasticsearch
clients.
"""
from os import listdir
from os import walk
from os.path import dirname, abspath, join
import yaml
from unittest import TestCase, SkipTest
@@ -139,12 +139,12 @@ def construct_case(filename, name):
yaml_dir = join(abspath(dirname(__file__)), 'yaml')
# find all the test definitions in yaml files ...
for filename in listdir(yaml_dir):
if not filename.endswith('.yaml'):
continue
# ... parse them
name = 'Test' + filename.rsplit('.', 1)[0][3:].title()
# and insert them into locals for test runner to find them
locals()[name] = construct_case(join(yaml_dir, filename), name)
for (path, dirs, files) in walk(yaml_dir):
for filename in files:
if not filename.endswith('.yaml'):
continue
# ... parse them
name = 'Test' + ''.join(s.title() for s in path.split('/')) + filename.rsplit('.', 1)[0][3:].title()
# and insert them into locals for test runner to find them
locals()[name] = construct_case(join(path, filename), name)