Compile tests check source files for valid syntax on all supported python versions:
Unit tests can be run across the whole code base by doing:
cd /path/to/ansible/source source hacking/env-setup ansible-test compile
Against a single file by doing:
ansible-test compile lineinfile
Or against a specific Python version by doing:
ansible-test compile --python 2.7 lineinfile
For advanced usage see the help:
ansible-test units --help
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:
ansible-test units --requirements lineinfile
The full list of requirements can be found at test/runner/requirements. Requirements files are named after their respective commands. See also the constraints applicable to all commands.
If you believe changes are needed to the Compile tests please add a comment on the Testing Working Group Agenda so it can be discussed.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/dev_guide/testing_compile.html