diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-01-19 14:06:35 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-01-19 15:05:26 -0500 |
| commit | 6d4e23882a5b1e1f31fb452aaad9d19cf0d02604 (patch) | |
| tree | 571fa87a7dab690a86fc611a716e433d279d21ff | |
| parent | 7cd8b4966a6e7186ff45fe1f1c09a58f8a678113 (diff) | |
| download | python-setuptools-git-6d4e23882a5b1e1f31fb452aaad9d19cf0d02604.tar.gz | |
Move test dependencies to package metadata.
| -rw-r--r-- | setup.cfg | 13 | ||||
| -rw-r--r-- | tests/requirements.txt | 12 | ||||
| -rw-r--r-- | tools/tox_pip.py | 20 | ||||
| -rw-r--r-- | tox.ini | 3 |
4 files changed, 34 insertions, 14 deletions
@@ -57,3 +57,16 @@ ssl = wincertstore==0.2; sys_platform=='win32' certs = certifi==2016.9.26 +tests = + mock + pytest-flake8 + flake8-2020; python_version>="3.6" + virtualenv>=13.0.0 + pytest-virtualenv>=1.2.7 + pytest>=3.7 + wheel + coverage>=4.5.1 + pytest-cov>=2.5.1 + paver; python_version>="3.6" + futures; python_version=="2.7" + pip>=19.1 # For proper file:// URLs support. diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index 19bf5aef..00000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -mock -pytest-flake8 -flake8-2020; python_version>="3.6" -virtualenv>=13.0.0 -pytest-virtualenv>=1.2.7 -pytest>=3.7 -wheel -coverage>=4.5.1 -pytest-cov>=2.5.1 -paver; python_version>="3.6" -futures; python_version=="2.7" -pip>=19.1 # For proper file:// URLs support. diff --git a/tools/tox_pip.py b/tools/tox_pip.py index 2d33e9e5..1b7eeda5 100644 --- a/tools/tox_pip.py +++ b/tools/tox_pip.py @@ -1,6 +1,7 @@ import os import subprocess import sys +import re def remove_setuptools(): @@ -20,12 +21,29 @@ def bootstrap(): subprocess.check_call(cmd) +def is_install_self(args): + """ + Do the args represent an install of .? + """ + def strip_extras(arg): + match = re.match(r'(.*)?\[.*\]$', arg) + return match.group(1) if match else arg + + return ( + 'install' in args + and any( + arg in ['.', os.getcwd()] + for arg in map(strip_extras, args) + ) + ) + + def pip(args): # Honor requires-python when installing test suite dependencies if any('-r' in arg for arg in args): os.environ['PIP_IGNORE_REQUIRES_PYTHON'] = '0' - if '.' in args: + if is_install_self(args): remove_setuptools() bootstrap() @@ -13,7 +13,6 @@ requires = pip = python {toxinidir}/tools/tox_pip.py [testenv] -deps=-r{toxinidir}/tests/requirements.txt pip_version = pip install_command = {[helpers]pip} install {opts} {packages} list_dependencies_command = {[helpers]pip} freeze --all @@ -25,6 +24,8 @@ setenv = passenv=APPDATA HOMEDRIVE HOMEPATH windir APPVEYOR APPVEYOR_* CI CODECOV_* TRAVIS TRAVIS_* NETWORK_REQUIRED commands=pytest --cov-config={toxinidir}/tox.ini --cov-report= {posargs} usedevelop=True +extras = + tests [testenv:coverage] |
