tox/appveyor: try creating pythonX.Y.bat file to run with specific python.exe
https://nedbatchelder.com/blog/201509/appveyor.html The old TOXPYTHON trick seems to be discouraged now with tox 3.1, which emits a warning when there is a conflict in the basepython settings for environments containing default factors (e.g. py27, etc.) https://github.com/tox-dev/tox/pull/841
This commit is contained in:
parent
1a94fbc121
commit
e59b89c6ab
@ -5,13 +5,11 @@ environment:
|
|||||||
PYTHON_VERSION: "2.7.x"
|
PYTHON_VERSION: "2.7.x"
|
||||||
PYTHON_ARCH: "32"
|
PYTHON_ARCH: "32"
|
||||||
TOXENV: "py27-cov,py27-cov-lxml"
|
TOXENV: "py27-cov,py27-cov-lxml"
|
||||||
TOXPYTHON: "C:\\Python27\\python.exe"
|
|
||||||
|
|
||||||
- PYTHON: "C:\\Python36-x64"
|
- PYTHON: "C:\\Python36-x64"
|
||||||
PYTHON_VERSION: "3.6.x"
|
PYTHON_VERSION: "3.6.x"
|
||||||
PYTHON_ARCH: "64"
|
PYTHON_ARCH: "64"
|
||||||
TOXENV: "py36-cov,py36-cov-lxml"
|
TOXENV: "py36-cov,py36-cov-lxml"
|
||||||
TOXPYTHON: "C:\\Python36-x64\\python.exe"
|
|
||||||
|
|
||||||
- PYTHON: "C:\\Python37-x64"
|
- PYTHON: "C:\\Python37-x64"
|
||||||
PYTHON_VERSION: "3.7.x"
|
PYTHON_VERSION: "3.7.x"
|
||||||
@ -19,7 +17,6 @@ environment:
|
|||||||
# lxml doesn't have windows 3.7 wheels yet
|
# lxml doesn't have windows 3.7 wheels yet
|
||||||
# TOXENV: "py37-cov,py37-cov-lxml"
|
# TOXENV: "py37-cov,py37-cov-lxml"
|
||||||
TOXENV: "py37-cov"
|
TOXENV: "py37-cov"
|
||||||
TOXPYTHON: "C:\\Python37-x64\\python.exe"
|
|
||||||
|
|
||||||
skip_branch_with_pr: true
|
skip_branch_with_pr: true
|
||||||
|
|
||||||
@ -50,6 +47,12 @@ install:
|
|||||||
# install tox to run test suite in a virtual environment
|
# install tox to run test suite in a virtual environment
|
||||||
- "pip install -U tox"
|
- "pip install -U tox"
|
||||||
|
|
||||||
|
# Make a python3.7.bat file in the current directory so that tox will find it
|
||||||
|
# and python3.7 will mean what we want it to. E.g. for TOXENV=py27, this will
|
||||||
|
# save a python2.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:]), 'w').write('@{0}\\\\python \\x25*\\n'.format(os.environ['PYTHON']))\""
|
||||||
|
|
||||||
build: false
|
build: false
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
|
10
tox.ini
10
tox.ini
@ -4,12 +4,6 @@ minversion = 2.9.1
|
|||||||
skip_missing_interpreters = true
|
skip_missing_interpreters = true
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basepython =
|
|
||||||
# we use TOXPYTHON env variable to specify the location of Appveyor Python
|
|
||||||
py27: {env:TOXPYTHON:python2.7}
|
|
||||||
py35: {env:TOXPYTHON:python3.5}
|
|
||||||
py36: {env:TOXPYTHON:python3.6}
|
|
||||||
py37: {env:TOXPYTHON:python3.7}
|
|
||||||
description = run the tests with pytest under {basepython}
|
description = run the tests with pytest under {basepython}
|
||||||
setenv =
|
setenv =
|
||||||
COVERAGE_FILE={toxinidir}/.coverage.{envname}
|
COVERAGE_FILE={toxinidir}/.coverage.{envname}
|
||||||
@ -24,7 +18,6 @@ commands =
|
|||||||
[testenv:coverage]
|
[testenv:coverage]
|
||||||
description = run locally after tests to combine coverage data and create reports;
|
description = run locally after tests to combine coverage data and create reports;
|
||||||
generates a diff coverage against origin/master (or DIFF_AGAINST env var)
|
generates a diff coverage against origin/master (or DIFF_AGAINST env var)
|
||||||
basepython = {env:TOXPYTHON:python}
|
|
||||||
deps =
|
deps =
|
||||||
coverage >= 4.4.1, < 5
|
coverage >= 4.4.1, < 5
|
||||||
diff_cover
|
diff_cover
|
||||||
@ -44,7 +37,6 @@ commands =
|
|||||||
|
|
||||||
[testenv:codecov]
|
[testenv:codecov]
|
||||||
description = upload coverage data to codecov (only run on CI)
|
description = upload coverage data to codecov (only run on CI)
|
||||||
basepython = {env:TOXPYTHON:python}
|
|
||||||
deps =
|
deps =
|
||||||
{[testenv:coverage]deps}
|
{[testenv:coverage]deps}
|
||||||
codecov
|
codecov
|
||||||
@ -58,7 +50,6 @@ commands =
|
|||||||
|
|
||||||
[testenv:sdist]
|
[testenv:sdist]
|
||||||
description = build sdist to be uploaded to PyPI
|
description = build sdist to be uploaded to PyPI
|
||||||
basepython = {env:TOXPYTHON:python}
|
|
||||||
skip_install = true
|
skip_install = true
|
||||||
deps =
|
deps =
|
||||||
setuptools >= 36.4.0
|
setuptools >= 36.4.0
|
||||||
@ -70,7 +61,6 @@ commands =
|
|||||||
|
|
||||||
[testenv:wheel]
|
[testenv:wheel]
|
||||||
description = build wheel package for upload to PyPI
|
description = build wheel package for upload to PyPI
|
||||||
basepython = {env:TOXPYTHON:python}
|
|
||||||
skip_install = true
|
skip_install = true
|
||||||
deps = {[testenv:sdist]deps}
|
deps = {[testenv:sdist]deps}
|
||||||
changedir = {toxinidir}
|
changedir = {toxinidir}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user