# tox.ini # Copyright (c) 2013-2019 Pablo Acosta-Serafini # See LICENSE for details # [[[cog # import os # PKG_NAME = os.path.basename(os.path.dirname(os.path.abspath(cog.inFile))) # exec("from " + PKG_NAME.replace("-", "_") + ".pkgdata import SUPPORTED_INTERPS") # PYVERS = [("py"+item).replace(".", "") for item in SUPPORTED_INTERPS] # pymatrix="{"+",".join(PYVERS)+"}-pkg" # cog.outl("[tox]") # cog.outl("envlist=rtd,"+pymatrix) # cog.outl("skip_missing_interpreters=True") # cog.outl("") # cog.outl("[testenv]") # cog.outl("whitelist_externals=") # cog.outl(" make") # cog.outl("basepython=") # cog.outl(" rtd: python2.7") # for pyver, ver in zip(PYVERS, SUPPORTED_INTERPS): # cog.outl(" {0}: python{1}".format(pyver, ver)) # cog.outl("envdir=") # cog.outl(" rtd: {toxworkdir}/rtd") # for pyver in PYVERS: # cog.outl(" {0}: {{toxworkdir}}/{0}".format(pyver)) # cog.outl("passenv=") # cog.outl(" HOME READTHEDOCS") # cog.outl("setenv=") # cog.outl(" PIP_USE_MIRRORS=true") # cog.outl(" PYTHONPATH={envsitepackagesdir}:{envdir}/share/{env:PKG_NAME}:{envdir}/share/{env:PKG_NAME}/tests:{envdir}/share/{env:PKG_NAME}/tests/support:{envdir}/share/{env:PKG_NAME}/docs:{envdir}/share/{env:PKG_NAME}/docs/support") # cog.outl(" SBIN_DIR={envdir}/share/{env:PKG_NAME}/pypkg") # cog.outl(" TRACER_DIR={envdir}/share/{env:PKG_NAME}/docs/support") # cog.outl("deps=") # cog.outl(" rtd: -r{toxinidir}/requirements/rtd.pip") # for pyver in PYVERS: # cog.outl(" {0}: -r{{toxinidir}}/requirements/tests_{0}.pip".format(pyver)) # for pyver in PYVERS: # cog.outl(" {0}: -r{{toxinidir}}/requirements/docs_{0}.pip".format(pyver)) # cog.outl("changedir=") # cog.outl(" {envdir}/share/{env:PKG_NAME}/tests") # cog.outl("commands=") # cog.outl("# Package validation") # cog.outl("# Print banner") # cog.outl(' rtd: {env:SBIN_DIR}/cprint.sh banner "Hosted documentation build"') # for pyver, ver in zip(PYVERS, SUPPORTED_INTERPS): # cog.outl(' {0}-pkg: {{env:SBIN_DIR}}/cprint.sh banner "Python {1} package validation"'.format(pyver, ver), dedent=False) # cog.outl(" {0}: {{env:SBIN_DIR}}/print-env.sh".format(pymatrix)) # cog.outl("# Dynamically create configuration files") # cog.outl(" {0}: {{envpython}} {{env:SBIN_DIR}}/coveragerc_manager.py 'tox' 1 {{envname}} {{toxinidir}} {{envsitepackagesdir}}".format(pymatrix)) # cog.outl("# Test Pylint compliance") # cog.outl(" {0}: {{env:SBIN_DIR}}/cprint.sh line cyan \"Testing Pylint compliance\"".format(pymatrix)) # cog.outl(" {0}: make --makefile={{envdir}}/share/{{env:PKG_NAME}}/Makefile lint REPO_DIR={{toxinidir}} SOURCE_DIR={{envsitepackagesdir}}/{{env:PKG_NAME}} EXTRA_DIR={{envdir}}/share/{{env:PKG_NAME}}".format(pymatrix)) # cog.outl("# Test reStructuredText files") # cog.outl(" {0}: {{env:SBIN_DIR}}/pytest-rst.sh {{env:SBIN_DIR}} {{envbindir}} {{envdir}}/share/{{env:PKG_NAME}}/docs {{posargs}}".format(pymatrix)) # cog.outl("# Test docstrings") # cog.outl(" {0}: {{env:SBIN_DIR}}/pytest-doctests.sh {{env:SBIN_DIR}} {{envbindir}} {{envsitepackagesdir}}/{{env:PKG_NAME}} {{posargs}}".format(pymatrix)) # cog.outl("# Test coverage") # cog.outl(" {0}: {{env:SBIN_DIR}}/cprint.sh line cyan \"Testing coverage\"".format(pymatrix)) # cog.outl(" {0}: {{envbindir}}/py.test {{posargs}} --cov-config {{envsitepackagesdir}}/{{env:PKG_NAME}}/.coveragerc_tox_{{envname}} --cov {{envsitepackagesdir}}/{{env:PKG_NAME}} --cov-report term".format(pymatrix)) # cog.outl("# Test documentation") # cog.outl(" {0}: {{env:SBIN_DIR}}/cprint.sh line cyan \"Testing documentation\"".format(pymatrix)) # cog.outl(" {0}: {{env:SBIN_DIR}}/build_docs.py {{posargs}} -r -t -d {{envsitepackagesdir}}/{{env:PKG_NAME}}".format(pymatrix)) # cog.outl(" {0}: {{envpython}} {{env:SBIN_DIR}}/coveragerc_manager.py 'tox' 0 {{envname}} {{toxinidir}} {{envsitepackagesdir}}".format(pymatrix)) # pymatrix="{"+",".join(PYVERS)+"}-repl" # cog.outl("# Get interactive interpreter prompt") # cog.outl(" {0}: {{envpython}} {{posargs}}".format(pymatrix)) # pymatrix="{"+",".join(PYVERS)+"}-test" # cog.outl("# Direct connection to py.test") # cog.outl(" {0}: {{envbindir}}/py.test {{posargs}}".format(pymatrix)) # pymatrix="{"+",".join(PYVERS)+"}-cov" # cog.outl("# Test coverage and generate an HTML report") # cog.outl(" {0}: {{envpython}} {{env:SBIN_DIR}}/coveragerc_manager.py 'tox' 1 {{envname}} {{toxinidir}} {{envsitepackagesdir}}".format(pymatrix)) # cog.outl(" {0}: {{envbindir}}/py.test --cov-config {{envsitepackagesdir}}/{{env:PKG_NAME}}/.coveragerc_tox_{{envname}} --cov {{envsitepackagesdir}}/{{env:PKG_NAME}} --cov-report html {{posargs}}".format(pymatrix)) # cog.outl(" {0}: {{envpython}} {{env:SBIN_DIR}}/coveragerc_manager.py 'tox' 0 {{envname}} {{toxinidir}} {{envsitepackagesdir}}".format(pymatrix)) # cog.outl(" rtd: {envbindir}/sphinx-build -b html {envdir}/share/{env:PKG_NAME}/docs {envdir}/share/{env:PKG_NAME}/docs/_build") # ]]] [tox] envlist=rtd,{py27,py35,py36,py37}-pkg skip_missing_interpreters=True [testenv] whitelist_externals= make basepython= rtd: python2.7 py27: python2.7 py35: python3.5 py36: python3.6 py37: python3.7 envdir= rtd: {toxworkdir}/rtd py27: {toxworkdir}/py27 py35: {toxworkdir}/py35 py36: {toxworkdir}/py36 py37: {toxworkdir}/py37 passenv= HOME READTHEDOCS setenv= PIP_USE_MIRRORS=true PYTHONPATH={envsitepackagesdir}:{envdir}/share/{env:PKG_NAME}:{envdir}/share/{env:PKG_NAME}/tests:{envdir}/share/{env:PKG_NAME}/tests/support:{envdir}/share/{env:PKG_NAME}/docs:{envdir}/share/{env:PKG_NAME}/docs/support SBIN_DIR={envdir}/share/{env:PKG_NAME}/pypkg TRACER_DIR={envdir}/share/{env:PKG_NAME}/docs/support deps= rtd: -r{toxinidir}/requirements/rtd.pip py27: -r{toxinidir}/requirements/tests_py27.pip py35: -r{toxinidir}/requirements/tests_py35.pip py36: -r{toxinidir}/requirements/tests_py36.pip py37: -r{toxinidir}/requirements/tests_py37.pip py27: -r{toxinidir}/requirements/docs_py27.pip py35: -r{toxinidir}/requirements/docs_py35.pip py36: -r{toxinidir}/requirements/docs_py36.pip py37: -r{toxinidir}/requirements/docs_py37.pip changedir= {envdir}/share/{env:PKG_NAME}/tests commands= # Package validation # Print banner rtd: {env:SBIN_DIR}/cprint.sh banner "Hosted documentation build" py27-pkg: {env:SBIN_DIR}/cprint.sh banner "Python 2.7 package validation" py35-pkg: {env:SBIN_DIR}/cprint.sh banner "Python 3.5 package validation" py36-pkg: {env:SBIN_DIR}/cprint.sh banner "Python 3.6 package validation" py37-pkg: {env:SBIN_DIR}/cprint.sh banner "Python 3.7 package validation" {py27,py35,py36,py37}-pkg: {env:SBIN_DIR}/print-env.sh # Dynamically create configuration files {py27,py35,py36,py37}-pkg: {envpython} {env:SBIN_DIR}/coveragerc_manager.py 'tox' 1 {envname} {toxinidir} {envsitepackagesdir} # Test Pylint compliance {py27,py35,py36,py37}-pkg: {env:SBIN_DIR}/cprint.sh line cyan "Testing Pylint compliance" {py27,py35,py36,py37}-pkg: make --makefile={envdir}/share/{env:PKG_NAME}/Makefile lint REPO_DIR={toxinidir} SOURCE_DIR={envsitepackagesdir}/{env:PKG_NAME} EXTRA_DIR={envdir}/share/{env:PKG_NAME} # Test reStructuredText files {py27,py35,py36,py37}-pkg: {env:SBIN_DIR}/pytest-rst.sh {env:SBIN_DIR} {envbindir} {envdir}/share/{env:PKG_NAME}/docs {posargs} # Test docstrings {py27,py35,py36,py37}-pkg: {env:SBIN_DIR}/pytest-doctests.sh {env:SBIN_DIR} {envbindir} {envsitepackagesdir}/{env:PKG_NAME} {posargs} # Test coverage {py27,py35,py36,py37}-pkg: {env:SBIN_DIR}/cprint.sh line cyan "Testing coverage" {py27,py35,py36,py37}-pkg: {envbindir}/py.test {posargs} --cov-config {envsitepackagesdir}/{env:PKG_NAME}/.coveragerc_tox_{envname} --cov {envsitepackagesdir}/{env:PKG_NAME} --cov-report term # Test documentation {py27,py35,py36,py37}-pkg: {env:SBIN_DIR}/cprint.sh line cyan "Testing documentation" {py27,py35,py36,py37}-pkg: {env:SBIN_DIR}/build_docs.py {posargs} -r -t -d {envsitepackagesdir}/{env:PKG_NAME} {py27,py35,py36,py37}-pkg: {envpython} {env:SBIN_DIR}/coveragerc_manager.py 'tox' 0 {envname} {toxinidir} {envsitepackagesdir} # Get interactive interpreter prompt {py27,py35,py36,py37}-repl: {envpython} {posargs} # Direct connection to py.test {py27,py35,py36,py37}-test: {envbindir}/py.test {posargs} # Test coverage and generate an HTML report {py27,py35,py36,py37}-cov: {envpython} {env:SBIN_DIR}/coveragerc_manager.py 'tox' 1 {envname} {toxinidir} {envsitepackagesdir} {py27,py35,py36,py37}-cov: {envbindir}/py.test --cov-config {envsitepackagesdir}/{env:PKG_NAME}/.coveragerc_tox_{envname} --cov {envsitepackagesdir}/{env:PKG_NAME} --cov-report html {posargs} {py27,py35,py36,py37}-cov: {envpython} {env:SBIN_DIR}/coveragerc_manager.py 'tox' 0 {envname} {toxinidir} {envsitepackagesdir} rtd: {envbindir}/sphinx-build -b html {envdir}/share/{env:PKG_NAME}/docs {envdir}/share/{env:PKG_NAME}/docs/_build # [[[end]]]