Fix nox job python2.7 support

Virtualenv dropped python2.7 support. When we install latest nox it also
installs latest virtualenv. Then when we try to run python2.7 jobs which
will create a python2.7 venv things fail with:

  RuntimeError: failed to find interpreter for Builtin discover of python_spec='python2.7'

The underlying issue is that we are getting a too new virtualenv. Fix
this by adding a pre run step to the python2.7 jobs that downgrades to a
version of virtualenv that should support python2.7 environments.

Change-Id: I0ed9915b25c752cdaae4df19c9a0e0dc1aafd3d7
This commit is contained in:
Clark Boylan 2023-08-22 10:02:22 -07:00
parent 56653e0470
commit 7ae274dff8
2 changed files with 7 additions and 0 deletions

6
playbooks/nox/pre27.yaml Normal file
View File

@ -0,0 +1,6 @@
- hosts: all
tasks:
- name: Downgrade virtualenv for python2.7 support
# Assume pip is installed in the same relative path as nox
# and use that to downgrade virtualenv to a version python2.7 supports.
command: "{{ nox_executable | dirname }}/pip install -U virtualenv<20.22.0"

View File

@ -403,6 +403,7 @@
Run unit tests for a Python project under cPython version 2.7. Run unit tests for a Python project under cPython version 2.7.
Uses nox with the ``test`` keyword forcing python 2.7. Uses nox with the ``test`` keyword forcing python 2.7.
pre-run: playbooks/nox/pre27.yaml
vars: vars:
nox_keyword: tests nox_keyword: tests
nox_force_python: "2.7" nox_force_python: "2.7"