From d79b2dd6c7505ef4e437babe503013ae278d8e60 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 25 Jul 2018 18:09:16 +0100 Subject: [PATCH] tox/appveyor: don't use TOXPYTHON env var to select basepython; write a pythonX.Y.bat wrapper instead --- .appveyor.yml | 9 ++++++--- tox.ini | 10 ---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5187fb06e..a7eedc310 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,17 +3,14 @@ environment: - JOB: "2.7 32-bit" PYTHON_HOME: "C:\\Python27" TOXENV: "py27-cov" - TOXPYTHON: "C:\\Python27\\python.exe" - JOB: "3.6 64-bit" PYTHON_HOME: "C:\\Python36-x64" TOXENV: "py36-cov" - TOXPYTHON: "C:\\Python36-x64\\python.exe" - JOB: "3.7 64-bit" PYTHON_HOME: "C:\\Python37-x64" TOXENV: "py37-cov" - TOXPYTHON: "C:\\Python37-x64\\python.exe" install: # If there is a newer build queued for the same PR, cancel this one. @@ -39,6 +36,12 @@ install: # install the dependencies to run the tests - "python -m pip install tox" + # Make a 'pythonX.X.bat' file in the current directory so that tox will find + # it and 'pythonX.X' will mean what we want it to. E.g. for 'TOXENV=py37', + # this will save a 'python3.7.bat' file containing "@C:\Python27\python %*" + # Credit: https://nedbatchelder.com/blog/201509/appveyor.html + - "python -c \"import os; open('python{0}.{1}.bat'.format(*os.environ['TOXENV'][2:4]), 'w').write('@{0}\\\\python \\x25*\\n'.format(os.environ['PYTHON']))\"" + build: false diff --git a/tox.ini b/tox.ini index 682bb3ea9..04183752a 100644 --- a/tox.ini +++ b/tox.ini @@ -2,13 +2,6 @@ envlist = py{27,36,37}-cov, htmlcov [testenv] -basepython = - py27: {env:TOXPYTHON:python2.7} - pypy: {env:TOXPYTHON:pypy} - py34: {env:TOXPYTHON:python3.4} - py35: {env:TOXPYTHON:python3.5} - py36: {env:TOXPYTHON:python3.6} - py37: {env:TOXPYTHON:python3.7} deps = cov: coverage>=4.3 pytest @@ -24,7 +17,6 @@ commands = nocov: pytest {posargs} [testenv:htmlcov] -basepython = {env:TOXPYTHON:python3.6} deps = coverage>=4.3 skip_install = true @@ -34,7 +26,6 @@ commands = [testenv:codecov] passenv = * -basepython = {env:TOXPYTHON:python} deps = coverage>=4.3 codecov @@ -45,7 +36,6 @@ commands = codecov --env TOXENV [testenv:bdist] -basepython = {env:TOXPYTHON:python3.6} deps = pygments docutils