diff --git a/roles/fetch-subunit-output/files/find-subunit2html.sh b/roles/fetch-subunit-output/files/find-subunit2html.sh index b3f4307c3..6e47fdaab 100644 --- a/roles/fetch-subunit-output/files/find-subunit2html.sh +++ b/roles/fetch-subunit-output/files/find-subunit2html.sh @@ -36,6 +36,15 @@ if [[ -d .tox ]] ; then done fi +# Add all the nox envs to the path so that type will work. Prefer nox +# envs to tox and system path. If there is more than one nox env, it doesn't +# matter which one we use, PATH will find the first command. +if [[ -d .nox ]] ; then + for nox_bindir in $(find .nox -mindepth 2 -maxdepth 2 -name 'bin') ; do + PATH=$(pwd)/$nox_bindir:$PATH + done +fi + # NOTE(mordred): Fallback default to /usr/os-testr-env/bin/subunit2html # to provide a fallback case for OpenStack while we make sure this # logic works. Once we're satisfied that nobody is using diff --git a/roles/fetch-subunit-output/files/find-testr.sh b/roles/fetch-subunit-output/files/find-testr.sh index 3e5562d3f..9c11b6a89 100644 --- a/roles/fetch-subunit-output/files/find-testr.sh +++ b/roles/fetch-subunit-output/files/find-testr.sh @@ -61,6 +61,15 @@ if [[ -d .tox ]] ; then done fi +# Add all the nox envs to the path so that type will work. Prefer nox +# envs to tox and system path. If there is more than one nox env, it doesn't +# matter which one we use, PATH will find the first command. +if [[ -d .nox ]] ; then + for nox_bindir in $(find .nox -mindepth 2 -maxdepth 2 -name 'bin') ; do + PATH=$(pwd)/$nox_bindir:$PATH + done +fi + for command in $commands; do # Use -P instead of -p because we always want a path here even if # there is an alias or builtin. We also filter blank lines as we @@ -72,4 +81,5 @@ for command in $commands; do break fi done + exit $rc diff --git a/roles/fetch-subunit-output/tasks/main.yaml b/roles/fetch-subunit-output/tasks/main.yaml index 6fa1da526..b39d60769 100644 --- a/roles/fetch-subunit-output/tasks/main.yaml +++ b/roles/fetch-subunit-output/tasks/main.yaml @@ -1,6 +1,6 @@ # We're not using with_first_found because the files are remote, not local. # We want to use stestr if it exists or fallback to testr - and we want to -# prefer files found in tox envs. +# prefer files found in nox and tox envs. - name: Find stestr or testr executable script: "find-testr.sh {{ zuul_work_dir }}" register: testr_command diff --git a/test-playbooks/python/fetch-subunit-output.yaml b/test-playbooks/python/fetch-subunit-output.yaml index c308241f9..5926db80f 100644 --- a/test-playbooks/python/fetch-subunit-output.yaml +++ b/test-playbooks/python/fetch-subunit-output.yaml @@ -15,6 +15,9 @@ dest: "{{ zuul.project.src_dir }}/{{ item.dest }}" with_items: - content: | + [tox] + envlist = venv + [testenv] sitepackages = True usedevelop = True diff --git a/test-playbooks/python/fetch-tox-output.yaml b/test-playbooks/python/fetch-tox-output.yaml index 86b0c764a..70fa0210f 100644 --- a/test-playbooks/python/fetch-tox-output.yaml +++ b/test-playbooks/python/fetch-tox-output.yaml @@ -10,6 +10,9 @@ dest: "{{ zuul.project.src_dir }}/{{ item.dest }}" with_items: - content: | + [tox] + envlist = venv + [testenv] sitepackages = True usedevelop = True