Add tox_config_file rolevar to tox

In some situations, projects may not keep a tox.ini in the root
directory of their repository, or may even have multiple tox
configuration files. Allow the location and name of the config to be
overridden explicitly through the use of a new rolevar.

Change-Id: I1927142e6d9fa75e96902ae001c8ca98d69c7443
This commit is contained in:
Jeremy Stanley 2021-08-30 15:32:51 +00:00
parent f8a60d416f
commit 3d449a07df
3 changed files with 18 additions and 0 deletions

View File

@ -37,6 +37,12 @@ corresponding Zuul sibling projects and runs tox tests as follows:
Location of the tox executable.
.. zuul:rolevar:: tox_config_file
Path to a tox configuration file, or directory containing a
``tox.ini`` file. Will be provided to tox via its ``-c``
command-line option if set.
.. zuul:rolevar:: tox_extra_args
:default: -vv

View File

@ -28,6 +28,9 @@
debug:
msg: >-
{{ tox_executable }}
{% if tox_config_file is defined and tox_config_file %}
-c{{ tox_config_file }}
{% endif %}
{% if tox_envlist is defined and tox_envlist %}
-e{{ tox_envlist }}
{% endif %}
@ -40,6 +43,9 @@
environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}"
command: >-
{{ tox_executable }}
{% if tox_config_file is defined and tox_config_file %}
-c{{ tox_config_file }}
{% endif %}
{% if tox_envlist is defined and tox_envlist %}
-e{{ tox_envlist }}
{% endif %}

View File

@ -2,6 +2,9 @@
- name: Run tox without tests
command: >-
{{ tox_executable }}
{% if tox_config_file is defined and tox_config_file %}
-c{{ tox_config_file }}
{% endif %}
--notest
{% if tox_envlist is defined and tox_envlist %}
-e{{ tox_envlist }}
@ -18,6 +21,9 @@
- name: Get tox envlist config
shell: >-
{{ tox_executable }}
{% if tox_config_file is defined and tox_config_file %}
-c{{ tox_config_file }}
{% endif %}
--showconfig
{% if tox_envlist is defined and tox_envlist %}
-e{{ tox_envlist }}