From 13925d1965aa5658304c9ca88fb0307d6cff2eff Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 7 Dec 2022 14:34:51 -0800 Subject: [PATCH] Flip ensure-tox to tox v4 by default The previous change added a bunch of tox v4 compatiblity, now we switch to as our default. This should only happen after people have had sufficient time to add tox v4 compatibility or manually pin back to <4 in their projects. Change-Id: I16742fb933dba2162a73d532e1a9613af69021aa --- roles/ensure-tox/README.rst | 7 +++---- roles/ensure-tox/defaults/main.yaml | 2 +- test-playbooks/python/fetch-tox-output.yaml | 4 ++-- test-playbooks/python/tox.yaml | 12 +++++++++++- zuul-tests.d/python-jobs.yaml | 1 + 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/roles/ensure-tox/README.rst b/roles/ensure-tox/README.rst index b949c90cf..410a60421 100644 --- a/roles/ensure-tox/README.rst +++ b/roles/ensure-tox/README.rst @@ -6,13 +6,12 @@ virtual environment for the current user. **Role Variables** .. zuul:rolevar:: ensure_tox_version - :default: '<4' + :default: '' Version specifier to select the version of tox. For example if your project is not compatible with tox v4 you can set this value to - `<4` to install the latest v3 release. We have started this value - at `<4` for maximum compatibility, but expect it to change to '' - in the future when tox v4 is better understood. + `<4` to install the latest v3 release. The default is '' which + installs latest. .. zuul:rolevar:: tox_prefer_python2 :default: False diff --git a/roles/ensure-tox/defaults/main.yaml b/roles/ensure-tox/defaults/main.yaml index e9830eddf..055b54f1a 100644 --- a/roles/ensure-tox/defaults/main.yaml +++ b/roles/ensure-tox/defaults/main.yaml @@ -1,5 +1,5 @@ tox_executable: tox -ensure_tox_version: '<4' +ensure_tox_version: '' tox_venv_path: '{{ ansible_user_dir }}/.local/tox' tox_prefer_python2: false ensure_global_symlinks: false diff --git a/test-playbooks/python/fetch-tox-output.yaml b/test-playbooks/python/fetch-tox-output.yaml index 537e8ba9f..86b0c764a 100644 --- a/test-playbooks/python/fetch-tox-output.yaml +++ b/test-playbooks/python/fetch-tox-output.yaml @@ -56,14 +56,14 @@ post_tasks: - name: Check for artifact on the test instance stat: - path: "{{ ansible_user_dir }}/zuul-output/logs/tox/venv/venv-0.log" + path: "{{ ansible_user_dir }}/zuul-output/logs/tox/venv/1-install_package.log" register: _test_artifact failed_when: not _test_artifact.stat.exists when: zuul_use_fetch_output - name: Check for artifact on the executor stat: - path: "{{ zuul.executor.log_root }}/tox/venv/venv-0.log" + path: "{{ zuul.executor.log_root }}/tox/venv/1-install_package.log" delegate_to: localhost register: _executor_artifact failed_when: not _executor_artifact.stat.exists diff --git a/test-playbooks/python/tox.yaml b/test-playbooks/python/tox.yaml index 955ee1337..ba0e59b8c 100644 --- a/test-playbooks/python/tox.yaml +++ b/test-playbooks/python/tox.yaml @@ -76,12 +76,22 @@ register: ALL_status failed_when: ALL_status is changed + - name: Move test-playbooks/python/tox.ini to test-playbooks/python/foo.ini + # Tox 4 appears to have trouble when there is a tox.ini in the current + # dir and you run it with -c pointing at another file. Work around this + # to test the use of -c by moving the tox.ini to another location + # and -c'ing against that in the next task. + command: mv tox.ini foo.ini + args: + chdir: "{{ zuul.project.src_dir }}/test-playbooks/python/" + - name: Run tox against a specific config file include_role: name: tox vars: + zuul_work_dir: "{{ zuul.project.src_dir }}/test-playbooks/python/" # Make sure the tox_config_file option works - tox_config_file: test-playbooks/python + tox_config_file: foo.ini tox_envlist: 'foo' # Make sure we test with verbose output even if the default changes tox_extra_args: '-vv' diff --git a/zuul-tests.d/python-jobs.yaml b/zuul-tests.d/python-jobs.yaml index aa156e4a1..22e25f608 100644 --- a/zuul-tests.d/python-jobs.yaml +++ b/zuul-tests.d/python-jobs.yaml @@ -350,6 +350,7 @@ description: Test the tox role's sibling functionality files: - roles/tox/.* + - roles/ensure-tox/.* - tox.ini - test-playbooks/python/tox.yaml - test-playbooks/python/tox.ini