diff --git a/roles/tox/README.rst b/roles/tox/README.rst index 4ed87391b..fe157eda3 100644 --- a/roles/tox/README.rst +++ b/roles/tox/README.rst @@ -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 diff --git a/roles/tox/tasks/main.yaml b/roles/tox/tasks/main.yaml index b0e79f748..2cf8143ec 100644 --- a/roles/tox/tasks/main.yaml +++ b/roles/tox/tasks/main.yaml @@ -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 %} diff --git a/roles/tox/tasks/siblings.yaml b/roles/tox/tasks/siblings.yaml index c060d2974..a838f2e59 100644 --- a/roles/tox/tasks/siblings.yaml +++ b/roles/tox/tasks/siblings.yaml @@ -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 }}