Improve yml template test case.

Print out yml file name when failed to loading yml.

Change-Id: Ie34282b91ec8101ffa2676e3144acf5a054578b0
changes/60/247460/5
Eli Qiao 7 years ago
parent 25a06ec0c0
commit f2ab0c7498
  1. 7
      magnum/tests/unit/template/test_template.py

@ -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)

Loading…
Cancel
Save