Fix pep8 violations in tests
Some minor updates to the testing file so that it would pass a pep8 checker. Also adds a pep8 tox target to test them :) Change-Id: I5c704a1b5a1b5f8b6d80a8f538b56befbe656099
This commit is contained in:
5
test-requirements.txt
Normal file
5
test-requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
hacking>=0.10.0,<0.11
|
||||
@@ -75,7 +75,7 @@ class TestTitles(testtools.TestCase):
|
||||
self.assertTrue(
|
||||
len(line) < 80,
|
||||
msg="%s:%d: Line limited to a maximum of 79 characters." %
|
||||
(tpl, i+1))
|
||||
(tpl, i + 1))
|
||||
|
||||
def _check_no_cr(self, tpl, raw):
|
||||
matches = re.findall('\r', raw)
|
||||
@@ -84,13 +84,11 @@ class TestTitles(testtools.TestCase):
|
||||
"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))
|
||||
|
||||
self.assertEqual(len(trailing_spaces), 0,
|
||||
"Found trailing spaces on line %s of %s" % (i + 1, tpl))
|
||||
|
||||
def test_template(self):
|
||||
releases = [x.split('/')[1] for x in glob.glob('specs/*/')]
|
||||
|
||||
11
tox.ini
11
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,py27
|
||||
envlist = docs,py27,pep8
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
@@ -22,3 +22,12 @@ commands = {posargs}
|
||||
commands =
|
||||
find . -type f -name "*.pyc" -delete
|
||||
python setup.py build_sphinx
|
||||
|
||||
[testenv:pep8]
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
flake8 {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore = E128
|
||||
exclude = .venv,.git,.tox,doc,.eggs
|
||||
|
||||
Reference in New Issue
Block a user