From db259bfc1b18e6d3518237dccaef9a7dff401174 Mon Sep 17 00:00:00 2001 From: Ruby Loo Date: Wed, 30 Sep 2015 16:20:16 +0000 Subject: [PATCH] Use doc8 style checker This uses the doc8 style checker to check that the documents conform to certain requirements, as documented at https://pypi.python.org/pypi/doc8. In particular, we no longer need to check for these in our test code since they are checked via doc8: - lines don't exceed 79 chars - there are no trailing spaces - there are no carriage returns Some existing specs were modified because they had tabs or no newlines at the end of the file. Change-Id: If27281c7efd60c9f15ca07c723dd94a7d086c325 --- .../ironic-ilo-power-driver.rst | 3 +- specs/juno-implemented/swift-temp-url.rst | 3 +- .../kilo-implemented/ilo-cleaning-support.rst | 14 +++++----- test-requirements.txt | 6 ++++ tests/test_titles.py | 28 ------------------- tox.ini | 8 ++++-- 6 files changed, 23 insertions(+), 39 deletions(-) create mode 100644 test-requirements.txt diff --git a/specs/juno-implemented/ironic-ilo-power-driver.rst b/specs/juno-implemented/ironic-ilo-power-driver.rst index 624ab38a..70513be8 100644 --- a/specs/juno-implemented/ironic-ilo-power-driver.rst +++ b/specs/juno-implemented/ironic-ilo-power-driver.rst @@ -142,4 +142,5 @@ HP iLO4 User Guide: http://h20628.www2.hp.com/km-ext/kmcsdirect/emr_na-c03334051-10.pdf HP Power Capping and HP Dynamic Power Capping -http://bit.ly/1m8sbEi \ No newline at end of file +http://bit.ly/1m8sbEi + diff --git a/specs/juno-implemented/swift-temp-url.rst b/specs/juno-implemented/swift-temp-url.rst index cb36ac26..da94c5f9 100644 --- a/specs/juno-implemented/swift-temp-url.rst +++ b/specs/juno-implemented/swift-temp-url.rst @@ -244,4 +244,5 @@ References * Proposed patch in python-swiftclient: https://review.openstack.org/#/c/102632/ -* Glance direct_url configuration: https://github.com/openstack/glance/blob/master/etc/glance-api.conf#L89 \ No newline at end of file +* Glance direct_url configuration: https://github.com/openstack/glance/blob/master/etc/glance-api.conf#L89 + diff --git a/specs/kilo-implemented/ilo-cleaning-support.rst b/specs/kilo-implemented/ilo-cleaning-support.rst index ca5e4bfc..06b43974 100644 --- a/specs/kilo-implemented/ilo-cleaning-support.rst +++ b/specs/kilo-implemented/ilo-cleaning-support.rst @@ -41,15 +41,15 @@ Proposed change To reset the secure boot keys to manufacturer's defaults. (Applicable if secure boot feature is supported for ironic drivers) - clear_secure_boot_keys() - To clear secure boot keys + To clear secure boot keys (Applicable if secure boot feature is supported for ironic drivers) * The suggested default ordering would be - - reset_ilo_credential() 9 - reset_secure_boot_keys() 8 - apply_base_firmware_settings() 7 - ilo_reset() 6 + reset_ilo_credential() 9 + reset_secure_boot_keys() 8 + apply_base_firmware_settings() 7 + ilo_reset() 6 * The priority of clear_secure_boot_keys() by default would be zero, operator would have option to choose either reset_secure_boot_keys or @@ -72,10 +72,10 @@ Proposed change eg: Following are the mandatory parameter keys required by the clean steps - 1. ``upgrade_firmware`` - ``ilo_firmware_location_url`` key, which can accept the http location url or swift url for the tar/gz - file of all the firmwares to be updated. + file of all the firmwares to be updated. 2. ``reset_ilo_credential`` - ``ilo_change_password``, which accepts the - default iLO password to be changed during cleaning. + default iLO password to be changed during cleaning. * If the keys are missing and if the respective clean step is enabled, warning message will be logged and the step will be no-op and continue with other diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..4c66706d --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,6 @@ +# 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. + +doc8 # Apache-2.0 + diff --git a/tests/test_titles.py b/tests/test_titles.py index 862ae0f0..9ac155e8 100644 --- a/tests/test_titles.py +++ b/tests/test_titles.py @@ -79,28 +79,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 _check_file_ext(self, filename): self.assertTrue(filename.endswith(".rst"), "spec's file must uses 'rst' extension.") @@ -169,9 +147,6 @@ class TestTitles(testtools.TestCase): (data, titles) = self._get_spec_titles(filename) self._check_titles(filename, template_titles, {}, titles) - self._check_lines_wrapping(filename, data) - self._check_no_cr(filename, data) - self._check_trailing_spaces(filename, data) self._check_license(data) self._check_filename(filename, data) @@ -184,7 +159,4 @@ class TestTitles(testtools.TestCase): (data, titles) = self._get_spec_titles(filename) self._check_titles(filename, DRAFT_REQUIRED_TITLES, template_titles, titles) - self._check_lines_wrapping(filename, data) - self._check_no_cr(filename, data) - self._check_trailing_spaces(filename, data) self._check_filename(filename, data) diff --git a/tox.ini b/tox.ini index e227c640..c6a5c9b6 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,12 @@ usedevelop = True install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} -deps = -r{toxinidir}/requirements.txt -commands = python setup.py testr --slowest --testr-args='{posargs}' +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = + python setup.py testr --slowest --testr-args='{posargs}' + doc8 specs/ doc/source README.rst [testenv:venv] commands = {posargs}