Print name of violating file in unittest
Include the name of the file that violates the unittest name check in the error message so that it's easy to track down the problem. Also, exclude emacs autosave files from the list. Change-Id: Ib6a8557ee2bc2262fb0235c5641bd9da70f66fe0
This commit is contained in:
parent
7bfc3f3706
commit
1c6fa5b335
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue