jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/382484 )
Change subject: setup.py and tox: split dependencies
......................................................................
setup.py and tox: split dependencies
* Split the OpenStack dependencies to a separate extras_require.
* Add an extras_require item with the minimum test dependencies.
* Set the install_requires to the minimum supported version if an
environment variable is set to allow to test also the minimum
supported version of the dependencies.
* tox: use only two environments one for the current version of
dependencies and one with the oldest supported ones.
* tox: add description of all the available environments, listable with
tox -lv or tox -av
* tox: add the unit-min environment to the list of the ones run by
* default to always run unit tests also against the oldest supported
version of each dependency.
Change-Id: If5bf5227b32170b1979276b990352ec77846d535
---
M setup.py
M tox.ini
2 files changed, 80 insertions(+), 28 deletions(-)
Approvals:
jenkins-bot: Verified
Volans: Looks good to me, approved
diff --git a/setup.py b/setup.py
index fdec6de..d6e1840 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Package configuration."""
+import os
from setuptools import find_packages, setup
@@ -7,31 +8,53 @@
with open('README.rst', 'r') as readme:
long_description = readme.read()
+# Required dependencies
install_requires = [
'clustershell==1.7.3',
'colorama>=0.3.2',
- 'keystoneauth1>=2.4.1',
'pyparsing==2.1.10',
- 'python-keystoneclient>=2.3.1',
- 'python-novaclient>=3.3.1',
'pyyaml>=3.11',
'requests>=2.12.0',
'tqdm>=4.11.2',
]
-tests_require = [
- 'bandit>=0.13.2',
- 'flake8>=3.2.1',
- 'mock>=2.0.0',
- 'pytest>=3.0.3',
- 'pytest-cov>=1.8.0',
- 'pytest-xdist>=1.15.0',
- 'requests-mock>=0.7.0',
- 'Sphinx>=1.4.9',
- 'sphinx-argparse>=0.1.15',
- 'sphinx_rtd_theme>=0.1.6',
- 'tox>=2.5.0',
- 'vulture>=0.6,<0.25', # Required for
https://github.com/landscapeio/prospector/issues/230
+# Extra dependencies
+extras_require = {
+ # Optional dependencies for additional features
+ 'with-openstack': [
+ 'keystoneauth1>=2.4.1',
+ 'python-keystoneclient>=2.3.1',
+ 'python-novaclient>=3.3.1',
+ ],
+
+ # Test dependencies
+ 'tests': [
+ 'bandit>=1.1.0',
+ 'flake8>=3.2.1',
+ 'mock>=2.0.0',
+ 'prospector[with_everything]>=0.12.4',
+ 'pytest-cov>=1.8.0',
+ 'pytest-xdist>=1.15.0',
+ 'pytest>=3.0.3',
+ 'requests-mock>=0.7.0',
+ 'sphinx_rtd_theme>=0.1.6',
+ 'sphinx-argparse>=0.1.15',
+ 'Sphinx>=1.4.9',
+ 'vulture>=0.6,<0.25', # Required for
https://github.com/landscapeio/prospector/issues/230
+ ],
+}
+
+# Add optional dependencies to the tests ones
+extras_require['tests'].extend(extras_require['with-openstack'])
+
+# Generate minimum dependencies
+extras_require['tests-min'] = [dep.replace('>=', '==') for dep in
extras_require['tests']]
+if os.getenv('CUMIN_MIN_DEPS', False):
+ install_requires = [dep.replace('>=', '==') for dep in install_requires]
+
+setup_requires = [
+ 'pytest-runner>=2.7.1',
+ 'setuptools_scm>=1.15.0',
]
setup(
@@ -59,7 +82,7 @@
'cumin = cumin.cli:main',
],
},
- extras_require={'tests': tests_require +
['prospector[with_everything]>=0.12.4']},
+ extras_require=extras_require,
install_requires=install_requires,
keywords=['cumin', 'automation', 'orchestration'],
license='GPLv3+',
@@ -67,8 +90,7 @@
name='cumin',
packages=find_packages(exclude=['*.tests', '*.tests.*']),
platforms=['GNU/Linux', 'BSD', 'MacOSX'],
- setup_requires=['pytest-runner>=2.7.1', 'setuptools_scm>=1.15.0'],
- tests_require=tests_require,
+ setup_requires=setup_requires,
url='https://github.com/wikimedia/cumin',
use_scm_version=True,
zip_safe=False,
diff --git a/tox.ini b/tox.ini
index 62d4e23..2e68254 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,13 +1,22 @@
[tox]
minversion = 1.6
-envlist = flake8, unit, bandit, prospector, sphinx
+envlist = flake8,unit{,-min},bandit,prospector,sphinx
[testenv]
usedevelop = True
basepython = python2.7
whitelist_externals = sed
+description =
+ flake8: Style consistency checker
+ unit: Run unit tests
+ bandit: Security-oriented static analyzer
+ prospector: Static analysis multi-tool
+ sphinx: Build documentation and manpages
+ integration: Run integration tests
+ min: [minimum supported version of dependencies]
+envdir = {toxworkdir}/tests
commands =
- flake8: flake8
+ flake8: flake8 setup.py cumin doc
unit: py.test --strict --cov-report term-missing --cov=cumin
cumin/tests/unit {posargs}
# Avoid bandit assert_used (B101) in tests
bandit: bandit -l -i -r --exclude cumin/tests cumin/
@@ -17,16 +26,37 @@
sphinx: python setup.py build_sphinx -b man
# Fix missing space after bold blocks in man page:
https://github.com/ribozz/sphinx-argparse/issues/80
sphinx: sed -i='' -e 's/^\.B/.B /' '{toxinidir}/doc/build/man/cumin.1'
+ integration: "{toxinidir}/cumin/tests/integration/docker.sh"
"transports/clustershell"
deps =
- # Use install_requires and extras_require['tests'] from setup.py
+ # Use install_requires and the additional extras_require[tests] from
setup.py, force the minimum version for
+ # environments where 'min' is one of the dash-separated token.
+ min: .[tests-min]
.[tests]
-
-[testenv:integration]
setenv =
- USER=root
- SUDO_USER=integration-tests
-commands =
- "{toxinidir}/cumin/tests/integration/docker.sh" "transports/clustershell"
+ min: CUMIN_MIN_DEPS=1
+ integration: USER=root
+ integration: SUDO_USER=integration-tests
+
+[testenv:flake8-min]
+envdir = {toxworkdir}/tests-min
+
+[testenv:unit-min]
+envdir = {toxworkdir}/tests-min
+
+[testenv:bandit-min]
+envdir = {toxworkdir}/tests-min
+
+[testenv:prospector-min]
+envdir = {toxworkdir}/tests-min
+
+[testenv:sphinx-min]
+envdir = {toxworkdir}/tests-min
+
+[testenv:integration-min]
+envdir = {toxworkdir}/tests-min
+
+# Forced to define it until https://github.com/tox-dev/tox/issues/505 is fixed
+[testenv:integration]
[flake8]
max-line-length = 120
--
To view, visit https://gerrit.wikimedia.org/r/382484
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If5bf5227b32170b1979276b990352ec77846d535
Gerrit-PatchSet: 12
Gerrit-Project: operations/software/cumin
Gerrit-Branch: master
Gerrit-Owner: Volans <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits