tox/appveyor: don't use TOXPYTHON env var to select basepython; write a pythonX.Y.bat wrapper instead

This commit is contained in:
Cosimo Lupo 2018-07-25 18:09:16 +01:00
parent 8991f2c097
commit d79b2dd6c7
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482
2 changed files with 6 additions and 13 deletions

View File

@ -3,17 +3,14 @@ environment:
- JOB: "2.7 32-bit" - JOB: "2.7 32-bit"
PYTHON_HOME: "C:\\Python27" PYTHON_HOME: "C:\\Python27"
TOXENV: "py27-cov" TOXENV: "py27-cov"
TOXPYTHON: "C:\\Python27\\python.exe"
- JOB: "3.6 64-bit" - JOB: "3.6 64-bit"
PYTHON_HOME: "C:\\Python36-x64" PYTHON_HOME: "C:\\Python36-x64"
TOXENV: "py36-cov" TOXENV: "py36-cov"
TOXPYTHON: "C:\\Python36-x64\\python.exe"
- JOB: "3.7 64-bit" - JOB: "3.7 64-bit"
PYTHON_HOME: "C:\\Python37-x64" PYTHON_HOME: "C:\\Python37-x64"
TOXENV: "py37-cov" TOXENV: "py37-cov"
TOXPYTHON: "C:\\Python37-x64\\python.exe"
install: install:
# If there is a newer build queued for the same PR, cancel this one. # 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 # install the dependencies to run the tests
- "python -m pip install tox" - "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 build: false

10
tox.ini
View File

@ -2,13 +2,6 @@
envlist = py{27,36,37}-cov, htmlcov envlist = py{27,36,37}-cov, htmlcov
[testenv] [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 = deps =
cov: coverage>=4.3 cov: coverage>=4.3
pytest pytest
@ -24,7 +17,6 @@ commands =
nocov: pytest {posargs} nocov: pytest {posargs}
[testenv:htmlcov] [testenv:htmlcov]
basepython = {env:TOXPYTHON:python3.6}
deps = deps =
coverage>=4.3 coverage>=4.3
skip_install = true skip_install = true
@ -34,7 +26,6 @@ commands =
[testenv:codecov] [testenv:codecov]
passenv = * passenv = *
basepython = {env:TOXPYTHON:python}
deps = deps =
coverage>=4.3 coverage>=4.3
codecov codecov
@ -45,7 +36,6 @@ commands =
codecov --env TOXENV codecov --env TOXENV
[testenv:bdist] [testenv:bdist]
basepython = {env:TOXPYTHON:python3.6}
deps = deps =
pygments pygments
docutils docutils