Merge "Print name of violating file in unittest"

This commit is contained in:
Jenkins 2017-05-18 11:28:47 +00:00 committed by Gerrit Code Review
commit ab7d331bd1
1 changed files with 6 additions and 2 deletions

View File

@ -88,8 +88,12 @@ class TestTitles(testtools.TestCase):
def test_template(self):
files = glob.glob("guidelines/*")
for file in files:
self.assertTrue(file.endswith(".rst") or file.endswith(".json"),
"guideline files must use 'rst' or 'json' extension.")
if file.endswith('~'):
continue
self.assertTrue(
file.endswith(".rst") or file.endswith(".json"),
"guideline file must use 'rst' or 'json'"
"extension: {file}".format(file=file))
with open(file) as f:
data = f.read()