Improve yml template test case.

Print out yml file name when failed to loading yml.

Change-Id: Ie34282b91ec8101ffa2676e3144acf5a054578b0
This commit is contained in:
Eli Qiao 2015-11-19 20:03:49 +08:00
parent 25a06ec0c0
commit f2ab0c7498
1 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import sys
from glob import glob
from oslo_config import cfg
@ -34,4 +35,8 @@ class TestTemplate(base.TestCase):
for y in glob(os.path.join(x[0], '*.yaml'))]:
with open(yml, 'r') as f:
yml_contents = f.read()
load(yml_contents)
try:
load(yml_contents)
except Exception:
error_msg = "file: %s: %s" % (yml, sys.exc_info()[1])
self.fail(error_msg)