Update fetch-subunit-output to look for nox envs

Some projects are converting from tox to nox for driving tests. This
means there isn't a tox env to find testr/stestr in. Update
fetch-subunit-output to look for nox envs as well.

Change-Id: I051c4b27d22921f1f0c3a44dc4eaccdbb50afa29
This commit is contained in:
Clark Boylan 2022-12-29 11:07:32 -08:00
parent 880bcb34ff
commit b5cabbbfc7
5 changed files with 26 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -15,6 +15,9 @@
dest: "{{ zuul.project.src_dir }}/{{ item.dest }}"
with_items:
- content: |
[tox]
envlist = venv
[testenv]
sitepackages = True
usedevelop = True

View File

@ -10,6 +10,9 @@
dest: "{{ zuul.project.src_dir }}/{{ item.dest }}"
with_items:
- content: |
[tox]
envlist = venv
[testenv]
sitepackages = True
usedevelop = True