Improve yml template test case.
Print out yml file name when failed to loading yml. Change-Id: Ie34282b91ec8101ffa2676e3144acf5a054578b0
This commit is contained in:
parent
25a06ec0c0
commit
f2ab0c7498
|
@ -12,6 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
@ -34,4 +35,8 @@ class TestTemplate(base.TestCase):
|
||||||
for y in glob(os.path.join(x[0], '*.yaml'))]:
|
for y in glob(os.path.join(x[0], '*.yaml'))]:
|
||||||
with open(yml, 'r') as f:
|
with open(yml, 'r') as f:
|
||||||
yml_contents = f.read()
|
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…
Reference in New Issue