Allow JSON files for JSON Schemas and JSON examples

It's often much cleaner to be able to separate out JSON Schemas and JSON
examples into their own files. JSON doesn't allow for multiline strings
so don't check line length on JSON files.

Change-Id: Idf0dc2aa1fd1e10ed3dfb953838e6ea469c76933
This commit is contained in:
Everett Toews 2015-03-25 21:07:25 -05:00
parent a560f422e3
commit b29a4a3113
1 changed files with 9 additions and 7 deletions

View File

@ -87,13 +87,15 @@ class TestTitles(testtools.TestCase):
def test_template(self):
files = glob.glob("guidelines/*")
for filename in files:
self.assertTrue(filename.endswith(".rst"),
"guideline files must use 'rst' extension.")
with open(filename) as f:
for file in files:
self.assertTrue(file.endswith(".rst") or file.endswith(".json"),
"guideline files must use 'rst' or 'json' extension.")
with open(file) as f:
data = f.read()
spec = docutils.core.publish_doctree(data)
self._check_lines_wrapping(filename, data)
self._check_no_cr(filename, data)
self._check_trailing_spaces(filename, data)
self._check_no_cr(file, data)
self._check_trailing_spaces(file, data)
if file.endswith(".rst"):
self._check_lines_wrapping(file, data)