mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
4264be2b18
* orphans testing pages to avoid not-in-toctree errors * orphans various pages pending reorg * adds module_utils and special_vars to main TOC * uses a glob for scenario_guide TOC * normalize and Sentence-case headings on community pages, typos * re-orgs community TOC, adds all pages to toctree * removes scenario guides index page * adds style guide to community index * basic update to style guide * fix typo that created a new error * removes not-in-toctree from ignore errors list * leave removing files for future cleanup task
73 lines
1.9 KiB
ReStructuredText
73 lines
1.9 KiB
ReStructuredText
:orphan:
|
|
|
|
.. _testing_compile:
|
|
|
|
*************
|
|
Compile Tests
|
|
*************
|
|
|
|
.. contents:: Topics
|
|
|
|
Overview
|
|
========
|
|
|
|
Compile tests check source files for valid syntax on all supported python versions:
|
|
|
|
- 2.4 (Ansible 2.3 only)
|
|
- 2.6
|
|
- 2.7
|
|
- 3.5
|
|
- 3.6
|
|
|
|
NOTE: In Ansible 2.4 and earlier the compile test was provided by a dedicated sub-command ``ansible-test compile`` instead of a sanity test using ``ansible-test sanity --test compile``.
|
|
|
|
Running compile tests locally
|
|
=============================
|
|
|
|
Compile tests can be run across the whole code base by doing:
|
|
|
|
.. code:: shell
|
|
|
|
cd /path/to/ansible/source
|
|
source hacking/env-setup
|
|
ansible-test sanity --test compile
|
|
|
|
Against a single file by doing:
|
|
|
|
.. code:: shell
|
|
|
|
ansible-test sanity --test compile lineinfile
|
|
|
|
Or against a specific Python version by doing:
|
|
|
|
.. code:: shell
|
|
|
|
ansible-test sanity --test compile --python 2.7 lineinfile
|
|
|
|
For advanced usage see the help:
|
|
|
|
.. code:: shell
|
|
|
|
ansible-test sanity --help
|
|
|
|
|
|
Installing dependencies
|
|
=======================
|
|
|
|
``ansible-test`` has a number of dependencies , for ``compile`` tests we suggest running the tests with ``--local``, which is the default
|
|
|
|
The dependencies can be installed using the ``--requirements`` argument. For example:
|
|
|
|
.. code:: shell
|
|
|
|
ansible-test sanity --test compile --requirements lineinfile
|
|
|
|
|
|
|
|
The full list of requirements can be found at `test/runner/requirements <https://github.com/ansible/ansible/tree/devel/test/runner/requirements>`_. Requirements files are named after their respective commands. See also the `constraints <https://github.com/ansible/ansible/blob/devel/test/runner/requirements/constraints.txt>`_ applicable to all commands.
|
|
|
|
|
|
Extending compile tests
|
|
=======================
|
|
|
|
If you believe changes are needed to the compile tests please add a comment on the `Testing Working Group Agenda <https://github.com/ansible/community/blob/master/meetings/README.md>`_ so it can be discussed.
|