diff --git a/roles/tox/defaults/main.yaml b/roles/tox/defaults/main.yaml index 775a25d65..cb70ca0a2 100644 --- a/roles/tox/defaults/main.yaml +++ b/roles/tox/defaults/main.yaml @@ -1,5 +1,8 @@ --- -tox_envlist: venv -zuul_work_dir: "src/{{ zuul.project.canonical_name }}" tox_environment: {} tox_environment_defaults: {} +tox_envlist: venv +tox_executable: tox +tox_extra_args: -vv + +zuul_work_dir: "src/{{ zuul.project.canonical_name }}" diff --git a/roles/tox/tasks/main.yaml b/roles/tox/tasks/main.yaml index 75a9f7260..44f7ed797 100644 --- a/roles/tox/tasks/main.yaml +++ b/roles/tox/tasks/main.yaml @@ -9,53 +9,6 @@ - name: Run tox args: - chdir: "{{ zuul_work_dir }}" - executable: /bin/bash + chdir: "{{ zuul_work_dir | default(omit) }}" environment: "{{ my_tox_environment }}" - shell: | - # If a bundle file is present, call tox with the jenkins version of - # the test environment so it is used. Otherwise, use the normal - # (non-bundle) test environment. - - venv={{ tox_envlist }} - - function process_testr_artifacts { - if [ ! -d ".testrepository" ] ; then - return - fi - - rancount=$($bin_path/testr last | sed -ne 's/Ran \([0-9]\+\).*tests in.*/\1/p') - if [ -z "$rancount" ] || [ "$rancount" -eq "0" ] ; then - echo - echo "Zero tests were run. At least one test should have been run." - echo "Failing this test as a result" - echo - exit 1 - fi - } - - function check_nose_html { - htmlreport=$(find . -name $NOSE_HTML_OUT_FILE) - if [ -f "$htmlreport" ]; then - passcount=$(grep -c 'tr class=.passClass' $htmlreport) - if [ $passcount -eq "0" ]; then - echo - echo "Zero tests passed, which probably means there was an error" - echo "parsing one of the python files, or that some other failure" - echo "during test setup prevented a sane run." - echo - exit 1 - fi - fi - } - - bin_path=.tox/$venv/bin - export PYTHON=$bin_path/python - - tox -vv -e$venv - result=$? - - process_testr_artifacts - check_nose_html - - exit $result + command: "{{ tox_executable }} -e{{ tox_envlist }} {{ tox_extra_args }}"