From 789218c215214bdc5a1d14b0bda0d6249c3ead70 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 14 Jul 2017 06:24:45 -0700 Subject: [PATCH] Initial ansible-test sanity docs. (#26775) * Rename no-iterkeys test for consistency. * Require docs for all ansible-test sanity tests. * Initial ansible-test sanity docs. * Fix capitalization of Python. * Fix sanity code smell test false positives. * Fix another code-smell false positive. --- docs/bin/testing_formatter.sh | 12 +++++++ docs/docsite/.gitignore | 1 + docs/docsite/Makefile | 6 +++- .../dev_guide/testing/sanity/ansible-doc.rst | 4 +++ .../sanity/ansible-var-precedence-check.rst | 4 +++ .../dev_guide/testing/sanity/boilerplate.rst | 11 ++++++ .../testing/sanity/configure-remoting-ps1.rst | 5 +++ .../dev_guide/testing/sanity/empty-init.rst | 7 ++++ .../rst/dev_guide/testing/sanity/import.rst | 5 +++ .../testing/sanity/integration-aliases.rst | 36 +++++++++++++++++++ .../dev_guide/testing/sanity/line-endings.rst | 4 +++ .../testing/sanity/no-basestring.rst | 4 +++ .../testing/sanity/no-dict-iteritems.rst | 16 +++++++++ .../testing/sanity/no-dict-iterkeys.rst | 9 +++++ .../testing/sanity/no-dict-itervalues.rst | 16 +++++++++ .../dev_guide/testing/sanity/no-list-cmp.rst | 8 +++++ .../rst/dev_guide/testing/sanity/pep8.rst | 6 ++++ .../testing/sanity/pylint-ansible-test.rst | 6 ++++ .../rst/dev_guide/testing/sanity/pylint.rst | 4 +++ .../testing/sanity/replace-urlopen.rst | 4 +++ .../required-and-default-attributes.rst | 5 +++ .../rst/dev_guide/testing/sanity/rstcheck.rst | 4 +++ .../dev_guide/testing/sanity/sanity-docs.rst | 4 +++ .../rst/dev_guide/testing/sanity/shebang.rst | 16 +++++++++ .../dev_guide/testing/sanity/shellcheck.rst | 4 +++ .../testing/sanity/test-constraints.rst | 4 +++ .../testing/sanity/use-compat-six.rst | 4 +++ .../testing/sanity/validate-modules.rst | 6 ++++ .../rst/dev_guide/testing/sanity/yamllint.rst | 4 +++ test/runner/lib/sanity.py | 29 +++++++++++++++ test/sanity/code-smell/no-basestring.sh | 2 ++ .../{no-iterkeys.sh => no-dict-iterkeys.sh} | 5 ++- test/sanity/code-smell/no-list-cmp.sh | 2 ++ 33 files changed, 255 insertions(+), 2 deletions(-) create mode 100755 docs/bin/testing_formatter.sh create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/ansible-doc.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/ansible-var-precedence-check.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/boilerplate.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/configure-remoting-ps1.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/empty-init.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/import.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/integration-aliases.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/line-endings.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/no-basestring.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/no-dict-iteritems.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/no-dict-iterkeys.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/no-dict-itervalues.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/no-list-cmp.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/pep8.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/pylint-ansible-test.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/pylint.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/replace-urlopen.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/required-and-default-attributes.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/rstcheck.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/sanity-docs.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/shebang.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/shellcheck.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/test-constraints.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/use-compat-six.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/validate-modules.rst create mode 100644 docs/docsite/rst/dev_guide/testing/sanity/yamllint.rst rename test/sanity/code-smell/{no-iterkeys.sh => no-dict-iterkeys.sh} (72%) diff --git a/docs/bin/testing_formatter.sh b/docs/bin/testing_formatter.sh new file mode 100755 index 0000000000..926bde9245 --- /dev/null +++ b/docs/bin/testing_formatter.sh @@ -0,0 +1,12 @@ +#!/bin/bash -eu + +cat <<- EOF > ../docsite/rst/dev_guide/testing/sanity/index.rst +Sanity Tests +============ + +The following sanity tests are available as \`\`--test\`\` options for \`\`ansible-test sanity\`\`: + +$(for test in $(../../test/runner/ansible-test sanity --list-tests); do echo "- :doc:\`${test} <${test}>\`"; done) + +This list is also available using \`\`ansible-test sanity --list-tests\`\`. +EOF diff --git a/docs/docsite/.gitignore b/docs/docsite/.gitignore index f2f4235afe..c6504b5659 100644 --- a/docs/docsite/.gitignore +++ b/docs/docsite/.gitignore @@ -11,6 +11,7 @@ ansible*.xml .buildinfo objects.inv .doctrees +rst/dev_guide/testing/sanity/index.rst rst/modules/*.rst rst/playbooks_keywords.rst *.min.css diff --git a/docs/docsite/Makefile b/docs/docsite/Makefile index 321aed07b0..00a716cdbb 100644 --- a/docs/docsite/Makefile +++ b/docs/docsite/Makefile @@ -1,6 +1,7 @@ OS := $(shell uname -s) SITELIB = $(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"): FORMATTER=../bin/plugin_formatter.py +TESTING_FORMATTER=../bin/testing_formatter.sh DUMPER=../bin/dump_keywords.py ifeq ($(shell echo $(OS) | egrep -ic 'Darwin|FreeBSD|OpenBSD|DragonFly'),1) CPUS ?= $(shell sysctl hw.ncpu|awk '{print $$2}') @@ -17,7 +18,7 @@ all: docs docs: clean htmldocs -htmldocs: keywords modules staticmin +htmldocs: testing keywords modules staticmin CPUS=$(CPUS) $(MAKE) -f Makefile.sphinx html webdocs: docs @@ -51,6 +52,9 @@ keywords: $(FORMATTER) ../templates/playbooks_keywords.rst.j2 modules: $(FORMATTER) ../templates/plugin.rst.j2 PYTHONPATH=../../lib $(FORMATTER) -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/ +testing: + $(TESTING_FORMATTER) + staticmin: cat _themes/srtd/static/css/theme.css | sed -e 's/^[ ]*//g; s/[ ]*$$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$$/d' | sed -e :a -e '$$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css diff --git a/docs/docsite/rst/dev_guide/testing/sanity/ansible-doc.rst b/docs/docsite/rst/dev_guide/testing/sanity/ansible-doc.rst new file mode 100644 index 0000000000..20a6a3ed78 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/ansible-doc.rst @@ -0,0 +1,4 @@ +Sanity Tests » ansible-doc +========================== + +Verifies that ``ansible-doc`` can parse module documentation on all supported Python versions. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/ansible-var-precedence-check.rst b/docs/docsite/rst/dev_guide/testing/sanity/ansible-var-precedence-check.rst new file mode 100644 index 0000000000..ff85557683 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/ansible-var-precedence-check.rst @@ -0,0 +1,4 @@ +Sanity Tests » ansible-var-precedence-check +=========================================== + +Check the order of precedence for Ansible variables against :doc:`variable_precedence`. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/boilerplate.rst b/docs/docsite/rst/dev_guide/testing/sanity/boilerplate.rst new file mode 100644 index 0000000000..a6fba7c406 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/boilerplate.rst @@ -0,0 +1,11 @@ +Sanity Tests » boilerplate +========================== + +Most Python files other than those under ``lib/ansible/modules/`` should include the following boilerplate: + +.. code-block:: python + + from __future__ import (absolute_import, division, print_function) + + __metaclass__ = type + diff --git a/docs/docsite/rst/dev_guide/testing/sanity/configure-remoting-ps1.rst b/docs/docsite/rst/dev_guide/testing/sanity/configure-remoting-ps1.rst new file mode 100644 index 0000000000..3c847c5b3f --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/configure-remoting-ps1.rst @@ -0,0 +1,5 @@ +Sanity Tests » configure-remoting-ps1 +===================================== + +The file ``examples/scripts/ConfigureRemotingForAnsible.ps1`` is required and must be a regular file. +It is used by external automated processes and cannot be moved, renamed or replaced with a symbolic link. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/empty-init.rst b/docs/docsite/rst/dev_guide/testing/sanity/empty-init.rst new file mode 100644 index 0000000000..198380d980 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/empty-init.rst @@ -0,0 +1,7 @@ +Sanity Tests » empty-init +========================= + +The ``__init__.py`` files under the following directories must be empty: + +- ``lib/ansible/modules/`` +- ``test/units/`` diff --git a/docs/docsite/rst/dev_guide/testing/sanity/import.rst b/docs/docsite/rst/dev_guide/testing/sanity/import.rst new file mode 100644 index 0000000000..1212ce2a34 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/import.rst @@ -0,0 +1,5 @@ +Sanity Tests » import +===================== + +All Python imports in ``lib/ansible/modules/`` and ``lib/ansible/module_utils/`` which are not from the Python standard library +must be imported in a try/except ImportError block. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/integration-aliases.rst b/docs/docsite/rst/dev_guide/testing/sanity/integration-aliases.rst new file mode 100644 index 0000000000..8e3b2e2e4f --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/integration-aliases.rst @@ -0,0 +1,36 @@ +Sanity Tests » integration-aliases +================================== + +Each integration test must have an ``aliases`` file to control test execution. + +If the tests cannot be run as part of CI (requires external services, unsupported dependencies, etc.), +then they most likely belong in ``test/integration/roles/`` instead of ``test/integration/targets/``. +In that case, do not add an ``aliases`` file. Instead, just relocate the tests. + +In some cases tests requiring external resources can be run as a part of CI. +This is often true when those resources can be provided by a docker container. + +However, if you think that the tests should be able to be supported by CI, please discuss test +organization with @mattclay or @gundalow on GitHub or #ansible-devel on IRC. + +If the tests can be run as part of CI, you'll need to add an appropriate CI alias, such as: + +- ``posix/ci/group1`` +- ``windows/ci/group2`` + +The CI groups are used to balance tests across multiple jobs to minimize test run time. +Using the relevant ``group1`` entry is fine in most cases. Groups can be changed later to redistribute tests. + +Aliases can also be used to express test requirements: + +- ``needs/privileged`` +- ``needs/root`` +- ``needs/ssh`` + +Other aliases are used to skip tests under certain conditions: + +- ``skip/freebsd`` +- ``skip/osx`` +- ``skip/python3`` + +Take a look at existing ``aliases`` files to see what aliases are available and how they're used. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/line-endings.rst b/docs/docsite/rst/dev_guide/testing/sanity/line-endings.rst new file mode 100644 index 0000000000..b2848e28ac --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/line-endings.rst @@ -0,0 +1,4 @@ +Sanity Tests » line-endings +=========================== + +All files must use ``\n`` for line endings instead of ``\r\n``. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/no-basestring.rst b/docs/docsite/rst/dev_guide/testing/sanity/no-basestring.rst new file mode 100644 index 0000000000..c4508ce42b --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/no-basestring.rst @@ -0,0 +1,4 @@ +Sanity Tests » no-basestring +============================ + +Do not use ``isinstance(s, basestring)``. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/no-dict-iteritems.rst b/docs/docsite/rst/dev_guide/testing/sanity/no-dict-iteritems.rst new file mode 100644 index 0000000000..1f3db3af06 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/no-dict-iteritems.rst @@ -0,0 +1,16 @@ +Sanity Tests » no-dict-iteritems +================================ + +The ``dict.iteritems`` method has been removed in Python 3. There are two recommended alternatives: + +.. code-block:: python + + for KEY, VALUE in DICT.items(): + pass + +.. code-block:: python + + from ansible.module_utils.six import iteritems + + for KEY, VALUE in iteritems(DICT): + pass diff --git a/docs/docsite/rst/dev_guide/testing/sanity/no-dict-iterkeys.rst b/docs/docsite/rst/dev_guide/testing/sanity/no-dict-iterkeys.rst new file mode 100644 index 0000000000..ca81daef23 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/no-dict-iterkeys.rst @@ -0,0 +1,9 @@ +Sanity Tests » no-dict-iterkeys +=============================== + +The ``dict.iterkeys`` method has been removed in Python 3. Use the following instead: + +.. code-block:: python + + for KEY in DICT: + pass diff --git a/docs/docsite/rst/dev_guide/testing/sanity/no-dict-itervalues.rst b/docs/docsite/rst/dev_guide/testing/sanity/no-dict-itervalues.rst new file mode 100644 index 0000000000..410988dc81 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/no-dict-itervalues.rst @@ -0,0 +1,16 @@ +Sanity Tests » no-dict-itervalues +================================= + +The ``dict.itervalues`` method has been removed in Python 3. There are two recommended alternatives: + +.. code-block:: python + + for VALUE in DICT.values(): + pass + +.. code-block:: python + + from ansible.module_utils.six import itervalues + + for VALUE in itervalues(DICT): + pass diff --git a/docs/docsite/rst/dev_guide/testing/sanity/no-list-cmp.rst b/docs/docsite/rst/dev_guide/testing/sanity/no-list-cmp.rst new file mode 100644 index 0000000000..6678ecb227 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/no-list-cmp.rst @@ -0,0 +1,8 @@ +Sanity Tests » no-list-cmp +========================== + +The ``cmp`` function has been removed in Python 3. + +See `When sorting, use key instead of cmp`_. + +.. _When sorting, use key instead of cmp: http://python3porting.com/preparing.html#when-sorting-use-key-instead-of-cmp diff --git a/docs/docsite/rst/dev_guide/testing/sanity/pep8.rst b/docs/docsite/rst/dev_guide/testing/sanity/pep8.rst new file mode 100644 index 0000000000..10ae274098 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/pep8.rst @@ -0,0 +1,6 @@ +Sanity Tests » pep8 +=================== + +Python static analysis for PEP 8 style guideline compliance. + +See :doc:`testing_pep8` for more information. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/pylint-ansible-test.rst b/docs/docsite/rst/dev_guide/testing/sanity/pylint-ansible-test.rst new file mode 100644 index 0000000000..d2bcf144d5 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/pylint-ansible-test.rst @@ -0,0 +1,6 @@ +Sanity Tests » pylint-ansible-test +================================== + +Python static analysis for common programming errors. + +A more strict set of rules applied to ``ansible-test``. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/pylint.rst b/docs/docsite/rst/dev_guide/testing/sanity/pylint.rst new file mode 100644 index 0000000000..b467756143 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/pylint.rst @@ -0,0 +1,4 @@ +Sanity Tests » pylint +===================== + +Python static analysis for common programming errors. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/replace-urlopen.rst b/docs/docsite/rst/dev_guide/testing/sanity/replace-urlopen.rst new file mode 100644 index 0000000000..310a1b2318 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/replace-urlopen.rst @@ -0,0 +1,4 @@ +Sanity Tests » replace-urlopen +============================== + +Use ``open_url`` from ``module_utils`` instead of ``urlopen``. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/required-and-default-attributes.rst b/docs/docsite/rst/dev_guide/testing/sanity/required-and-default-attributes.rst new file mode 100644 index 0000000000..830465c04a --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/required-and-default-attributes.rst @@ -0,0 +1,5 @@ +Sanity Tests » required-and-default-attributes +============================================== + +Use only one of ``default`` or ``required`` with ``FieldAttribute``. + diff --git a/docs/docsite/rst/dev_guide/testing/sanity/rstcheck.rst b/docs/docsite/rst/dev_guide/testing/sanity/rstcheck.rst new file mode 100644 index 0000000000..f58f5a7139 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/rstcheck.rst @@ -0,0 +1,4 @@ +Sanity Tests » rstcheck +======================= + +Check reStructuredText files for syntax and formatting issues. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/sanity-docs.rst b/docs/docsite/rst/dev_guide/testing/sanity/sanity-docs.rst new file mode 100644 index 0000000000..7c40f5622e --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/sanity-docs.rst @@ -0,0 +1,4 @@ +Sanity Tests » sanity-docs +========================== + +Documentation for each ``ansible-test sanity`` test is required. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/shebang.rst b/docs/docsite/rst/dev_guide/testing/sanity/shebang.rst new file mode 100644 index 0000000000..a72389c0a3 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/shebang.rst @@ -0,0 +1,16 @@ +Sanity Tests » shebang +====================== + +Most executable files should only use one of the following shebangs: + +- ``#!/bin/sh`` +- ``#!/bin/bash`` +- ``#!/usr/bin/make`` +- ``#!/usr/bin/env python`` +- ``#!/usr/bin/env bash`` + +NOTE: For ``#!/bin/bash``, any of the options ``eux`` may also be used, such as ``#!/bin/bash -eux``. + +This does not apply to Ansible modules, which should not be executable and must always use ``#!/usr/bin/python``. + +Some exceptions are permitted. Ask if you have questions. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/shellcheck.rst b/docs/docsite/rst/dev_guide/testing/sanity/shellcheck.rst new file mode 100644 index 0000000000..acd864dc8f --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/shellcheck.rst @@ -0,0 +1,4 @@ +Sanity Tests » shellcheck +========================= + +Static code analysis for shell scripts using the excellent `shellcheck `_ tool. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/test-constraints.rst b/docs/docsite/rst/dev_guide/testing/sanity/test-constraints.rst new file mode 100644 index 0000000000..0dcff71c39 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/test-constraints.rst @@ -0,0 +1,4 @@ +Sanity Tests » test-constraints +=============================== + +Constraints for test requirements should be in ``test/runner/requirements/constraints.txt``. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/use-compat-six.rst b/docs/docsite/rst/dev_guide/testing/sanity/use-compat-six.rst new file mode 100644 index 0000000000..62c3053ac2 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/use-compat-six.rst @@ -0,0 +1,4 @@ +Sanity Tests » use-compat-six +============================= + +Use ``six`` from ``module_utils`` instead of ``six``. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/validate-modules.rst b/docs/docsite/rst/dev_guide/testing/sanity/validate-modules.rst new file mode 100644 index 0000000000..623cd78a75 --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/validate-modules.rst @@ -0,0 +1,6 @@ +Sanity Tests » validate-modules +=============================== + +Analyze modules for common issues in code and documentation. + +See :doc:`testing_validate-modules` for more information. diff --git a/docs/docsite/rst/dev_guide/testing/sanity/yamllint.rst b/docs/docsite/rst/dev_guide/testing/sanity/yamllint.rst new file mode 100644 index 0000000000..2d3d0ae50a --- /dev/null +++ b/docs/docsite/rst/dev_guide/testing/sanity/yamllint.rst @@ -0,0 +1,4 @@ +Sanity Tests » yamllint +======================= + +Check YAML files for syntax and formatting issues. diff --git a/test/runner/lib/sanity.py b/test/runner/lib/sanity.py index 22a5df62b2..60289f39f2 100644 --- a/test/runner/lib/sanity.py +++ b/test/runner/lib/sanity.py @@ -626,6 +626,34 @@ def command_sanity_rstcheck(args, targets): return SanitySuccess(test) +# noinspection PyUnusedLocal +def command_sanity_sanity_docs(args, targets): # pylint: disable=locally-disabled, unused-argument + """ + :type args: SanityConfig + :type targets: SanityTargets + :rtype: SanityResult + """ + test = 'sanity-docs' + + sanity_dir = 'docs/docsite/rst/dev_guide/testing/sanity' + sanity_docs = set(part[0] for part in (os.path.splitext(name) for name in os.listdir(sanity_dir)) if part[1] == '.rst') + sanity_tests = set(sanity_test.name for sanity_test in sanity_get_tests()) + + missing = sanity_tests - sanity_docs + + results = [] + + results += [SanityMessage( + message='missing docs for ansible-test sanity --test %s' % r, + path=os.path.join(sanity_dir, '%s.rst' % r), + ) for r in sorted(missing)] + + if results: + return SanityFailure(test, messages=results) + + return SanitySuccess(test) + + def command_sanity_ansible_doc(args, targets, python_version): """ :type args: SanityConfig @@ -856,6 +884,7 @@ SANITY_TESTS = ( SanityFunc('pylint', command_sanity_pylint, intercept=False), SanityFunc('yamllint', command_sanity_yamllint, intercept=False), SanityFunc('rstcheck', command_sanity_rstcheck, intercept=False), + SanityFunc('sanity-docs', command_sanity_sanity_docs, intercept=False), SanityFunc('validate-modules', command_sanity_validate_modules, intercept=False), SanityFunc('ansible-doc', command_sanity_ansible_doc), SanityFunc('import', command_sanity_import), diff --git a/test/sanity/code-smell/no-basestring.sh b/test/sanity/code-smell/no-basestring.sh index ca2bbedc34..ac1f3a2072 100755 --- a/test/sanity/code-smell/no-basestring.sh +++ b/test/sanity/code-smell/no-basestring.sh @@ -6,6 +6,8 @@ BASESTRING_USERS=$(grep -r basestring . \ | grep isinstance \ | grep -v \ -e test/results/ \ + -e docs/docsite/_build/ \ + -e docs/docsite/rst/dev_guide/testing/sanity/ \ -e lib/ansible/module_utils/six/_six.py \ -e lib/ansible/modules/ \ -e '^[^:]*:#' diff --git a/test/sanity/code-smell/no-iterkeys.sh b/test/sanity/code-smell/no-dict-iterkeys.sh similarity index 72% rename from test/sanity/code-smell/no-iterkeys.sh rename to test/sanity/code-smell/no-dict-iterkeys.sh index 2c53398e05..a8eb5e1e21 100755 --- a/test/sanity/code-smell/no-iterkeys.sh +++ b/test/sanity/code-smell/no-dict-iterkeys.sh @@ -7,8 +7,11 @@ ITERKEYS_USERS=$(grep -r -I iterkeys . \ --exclude-dir docsite \ --exclude-dir results \ | grep -v \ + -e 'metadata-.*.json:' \ + -e lib/ansible.egg-info/ \ -e lib/ansible/module_utils/six/_six.py \ - -e test/sanity/code-smell/no-iterkeys.sh \ + -e docs/docsite/rst/dev_guide/testing/sanity/ \ + -e test/sanity/code-smell/no-dict-iterkeys.sh \ -e '^[^:]*:#' ) diff --git a/test/sanity/code-smell/no-list-cmp.sh b/test/sanity/code-smell/no-list-cmp.sh index f6b84ea816..c71c693d62 100755 --- a/test/sanity/code-smell/no-list-cmp.sh +++ b/test/sanity/code-smell/no-list-cmp.sh @@ -5,6 +5,8 @@ CMP_USERS=$(grep -rI ' cmp[^a-zA-Z0-9_:=]' . \ | grep -v \ -e lib/ansible/module_utils/six/_six.py \ -e .git \ + -e docs/docsite/_build/ \ + -e docs/docsite/rst/dev_guide/testing/sanity/ \ -e test/sanity/code-smell/no-list-cmp.sh )