Use doc8 to verify rst instead of custom tests
Fix a disproportionally long line in dns-sd. Change-Id: I9137ce1780e971824bffdd4e6557ddeb44c4db0b
This commit is contained in:
parent
e30aee5906
commit
3abffb4fd7
@ -4,6 +4,8 @@
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-py37
|
||||
- openstack-tox-linters
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-py37
|
||||
- openstack-tox-linters
|
||||
|
@ -81,7 +81,7 @@ discover the ``auth_url`` to use.
|
||||
|
||||
I issue a DNS request to retrieve ``SRV`` and ``TXT`` records::
|
||||
|
||||
$ nslookup -query=any "identity._openstack._tcp.mystack.example.com" master
|
||||
$ nslookup -query=any "identity._openstack._tcp.mystack.example.com"
|
||||
identity._openstack._tcp.mystack.example.com service = 0 0 443 os.mystack.example.com
|
||||
identity._openstack._tcp.mystack.example.com text = "txtvers=1" "path=/"
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
pbr>=1.0
|
||||
doc8>=0.6.0 # Apache-2.0
|
||||
openstackdocstheme>=1.18.1 # Apache-2.0
|
||||
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
|
||||
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
|
||||
import docutils.core
|
||||
import testtools
|
||||
@ -62,30 +61,6 @@ class TestTitles(testtools.TestCase):
|
||||
self.fail("While checking '%s':\n %s"
|
||||
% (filename, "\n ".join(msgs)))
|
||||
|
||||
def _check_lines_wrapping(self, tpl, raw):
|
||||
for i, line in enumerate(raw.split("\n")):
|
||||
if "http://" in line or "https://" in line:
|
||||
continue
|
||||
self.assertTrue(
|
||||
len(line) < 80,
|
||||
msg="%s:%d: Line limited to a maximum of 79 characters." %
|
||||
(tpl, i+1))
|
||||
|
||||
def _check_no_cr(self, tpl, raw):
|
||||
matches = re.findall('\r', raw)
|
||||
self.assertEqual(
|
||||
len(matches), 0,
|
||||
"Found %s literal carriage returns in file %s" %
|
||||
(len(matches), tpl))
|
||||
|
||||
|
||||
def _check_trailing_spaces(self, tpl, raw):
|
||||
for i, line in enumerate(raw.split("\n")):
|
||||
trailing_spaces = re.findall(" +$", line)
|
||||
self.assertEqual(len(trailing_spaces),0,
|
||||
"Found trailing spaces on line %s of %s" % (i+1, tpl))
|
||||
|
||||
|
||||
def test_template(self):
|
||||
filenames = glob.glob("guidelines/*")
|
||||
for filename in filenames:
|
||||
@ -100,9 +75,4 @@ class TestTitles(testtools.TestCase):
|
||||
with open(filename) as f:
|
||||
data = f.read()
|
||||
|
||||
spec = docutils.core.publish_doctree(data)
|
||||
self._check_no_cr(filename, data)
|
||||
self._check_trailing_spaces(filename, data)
|
||||
|
||||
if filename.endswith(".rst"):
|
||||
self._check_lines_wrapping(filename, data)
|
||||
docutils.core.publish_doctree(data)
|
||||
|
7
tox.ini
7
tox.ini
@ -2,7 +2,7 @@
|
||||
# Hold back to 1.4, since that's what's in Fedora 20 repos
|
||||
# and we don't need anything newer for nova-specs tests
|
||||
minversion = 1.4
|
||||
envlist = docs,py37
|
||||
envlist = docs,py37,linters
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
@ -13,6 +13,11 @@ install_command = pip install -U {opts} {packages}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
commands = stestr run --slowest {posargs}
|
||||
|
||||
[testenv:linters]
|
||||
commands =
|
||||
# Check the *.rst files
|
||||
doc8 README.rst guidelines
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user