summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernát Gábor <gaborjbernat@gmail.com>2018-10-22 18:42:59 +0300
committerGitHub <noreply@github.com>2018-10-22 18:42:59 +0300
commit83c616d851dfa1c37bfda90a814275d438fb6f78 (patch)
treebf97ff174ac2cb880f2d61613ff4575c97cc233b
parent29245ff72942e6e71813e5e7f7e0567ea347eb27 (diff)
downloadvirtualenv-83c616d851dfa1c37bfda90a814275d438fb6f78.tar.gz
Improve tox and add pyproject.toml (#1216)
* explain .gitignore * add documentations to tox.ini; python 3.7 to test envs * add coverage and timeout to tests * add pyproject.toml and isolated tox build
-rw-r--r--.gitignore21
-rw-r--r--pyproject.toml6
-rw-r--r--setup.py1
-rw-r--r--tox.ini87
4 files changed, 82 insertions, 33 deletions
diff --git a/.gitignore b/.gitignore
index 2d83067..50e807f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,25 @@
+# packaging
virtualenv.egg-info
build
dist
-docs/_build
-.DS_Store
-*.py[cod]
*.egg
.eggs
+
+# documentation
+docs/_build
+
+# python
+*.py[cod]
+
+# tools
.tox
-.cache
+.*_cache
+.DS_Store
+
+# tbd
/tests/test_activate_output.actual
/tests/test_activate_output.expected
+
+# IDE
+.idea
+.vscode
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..c70af8c
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,6 @@
+[build-system]
+requires = [
+ "setuptools >= 40.0.4",
+ "wheel >= 0.29.0",
+]
+build-backend = 'setuptools.build_meta'
diff --git a/setup.py b/setup.py
index 479ecf8..7928ce0 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
import os
import re
-import shutil
import sys
if sys.version_info[:2] < (2, 7):
diff --git a/tox.ini b/tox.ini
index 1251a88..58428b6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,36 +1,67 @@
[tox]
-# env names must be a valid python binary name, unless they have a
-# separate configuration
-envlist =
- python{2.7,3.4,3.5,3.6}, pypy{,3}, crosspython{2,3}, docs
+minversion = 3.3.0
+envlist = py{27,34,35,36,37}, pypy{,3}, cross_python{2,3}, docs, package_readme
+isolated_build = true
+skip_missing_interpreters = true
[testenv]
+description = run tests with {basepython}
+setenv = PIP_DISABLE_VERSION_CHECK = 1
+ COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
+deps = mock
+ pytest >= 3.0.0, <4
+ pytest-cov >= 2.5.1, <3
+ pytest-mock >= 1.10.0, <2
+ pytest-timeout >= 1.3.0, <2
+commands = pytest {posargs:\
+ --cov="virtualenv" \
+ --cov-config="{toxinidir}/tox.ini" \
+ --timeout=180 \
+ --junitxml={env:JUNIT_XML_FILE:{toxworkdir}/.test.{envname}.xml} \
+ . }
+
+[coverage:run]
+branch = true
+
+[coverage:report]
+skip_covered = True
+show_missing = True
+
+[coverage:paths]
+source = virtualenv
+ .tox/*/lib/python*/site-packages/virtualenv
+ .tox/pypy*/site-packages/virtualenv
+ .tox\*\Lib\site-packages\virtualenv
+ */virtualenv
+ *\virtualenv
+
+[testenv:cross_python2]
+description = test creating a python3 venv with a python2-based virtualenv
+basepython = python2
deps =
- mock
- pytest
-commands =
- py.test
-
-# Creating a python3 venv with a python2-based virtualenv
-[testenv:crosspython2]
-basepython=python2
-deps =
-commands =
- virtualenv -p python3 {envtmpdir}/{envname}
- {envtmpdir}/{envname}/bin/python -V 2>&1 | grep "Python 3"
+commands = virtualenv -p python3 {envtmpdir}/{envname}
+ {envtmpdir}/{envname}/bin/python -V 2>&1 | grep "Python 3"
+
-# Creating a python2 venv with a python3-based virtualenv
-[testenv:crosspython3]
-basepython=python3
+[testenv:cross_python3]
+description = test creating a python2 venv with a python3-based virtualenv
+basepython = python3
deps =
-commands =
- virtualenv -p python2 {envtmpdir}/{envname}
- {envtmpdir}/{envname}/bin/python -V 2>&1 | grep "Python 2"
+commands = virtualenv -p python2 {envtmpdir}/{envname}
+ {envtmpdir}/{envname}/bin/python -V 2>&1 | grep "Python 2"
[testenv:docs]
-deps =
- sphinx
- readme
-commands =
- sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
- python setup.py check -m -r -s
+basepython = python3
+description = build documentation
+deps = sphinx
+commands = sphinx-build -d "{envtmpdir}/doctree" docs "{toxworkdir}/docs_out" --color -W -bhtml {posargs}
+ python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))'
+
+[testenv:package_readme]
+description = check that the long description is valid (need for PyPi)
+deps = twine >= 1.12.1
+ pip >= 18.0.0
+skip_install = true
+extras =
+commands = pip wheel -w {envtmpdir}/build --no-deps .
+ twine check {envtmpdir}/build/*