Use extras for dependency installation

This allows to only install precisely what's required.

Change-Id: I2e9f19b03aca8452ae8fa83f50f7dbfc8e69b56f
This commit is contained in:
Julien Danjou 2015-12-16 16:46:04 +01:00 committed by Andreas Jaeger
parent 09866ac641
commit ce0a9456eb
8 changed files with 63 additions and 35 deletions

View File

@ -25,7 +25,6 @@ from oslo_config import fixture as fixture_config
from oslotest import mockpatch
import six
from six.moves.urllib import parse as urlparse
import sqlalchemy
from testtools import testcase
from aodh import service
@ -50,6 +49,7 @@ class SQLManager(fixtures.Fixture):
def __init__(self, conf):
self.conf = conf
db_name = 'aodh_%s' % uuid.uuid4().hex
import sqlalchemy
self._engine = sqlalchemy.create_engine(
conf.database.connection.replace(self.url_dbname_placeholder,
self.url_dbname_createstring))

View File

@ -20,12 +20,17 @@
server before running the tests.
"""
import unittest
from aodh.storage import impl_mongodb
try:
from aodh.storage import impl_mongodb
except ImportError:
impl_mongodb = None
from aodh.tests import base as test_base
from aodh.tests.functional import db as tests_db
@unittest.skipUnless(impl_mongodb, "pymongo not available")
@tests_db.run_with('mongodb')
class MongoDBConnection(tests_db.TestBase):
def test_connection_pooling(self):
@ -39,6 +44,7 @@ class MongoDBConnection(tests_db.TestBase):
self.assertTrue(conn.conn)
@unittest.skipUnless(impl_mongodb, "pymongo not available")
@tests_db.run_with('mongodb')
class IndexTest(tests_db.TestBase):
def _test_ttl_index_absent(self, conn, coll_name, ttl_opt):
@ -78,6 +84,7 @@ class IndexTest(tests_db.TestBase):
class CapabilitiesTest(test_base.BaseTestCase):
@unittest.skipUnless(impl_mongodb, "pymongo not available")
def test_alarm_capabilities(self):
expected_capabilities = {
'alarms': {'query': {'simple': True,

View File

@ -241,7 +241,7 @@ function install_aodh {
_aodh_prepare_coordination
_aodh_prepare_storage_backend
install_aodhclient
setup_develop $AODH_DIR
sudo -H pip install -e "$AODH_DIR"[test,$AODH_BACKEND]
sudo install -d -o $STACK_USER -m 755 $AODH_CONF_DIR $AODH_API_LOG_DIR
}

View File

@ -37,7 +37,7 @@ run through tox_.
3. Install the test dependencies::
$ sudo pip install -r /opt/stack/aodh/test-requirements.txt
$ sudo pip install -e /opt/stack/aodh[test]
4. Run the unit and code-style tests::

View File

@ -2,7 +2,6 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
alembic>=0.7.2
retrying!=1.3.0,>=1.2.3 # Apache-2.0
croniter>=0.3.4 # MIT License
jsonschema!=2.5.0,<3.0.0,>=2.0.0
@ -27,7 +26,6 @@ python-keystoneclient>=1.6.0
pytz>=2013.6
requests>=2.5.2
six>=1.9.0
SQLAlchemy<1.1.0,>=0.9.7
stevedore>=1.5.0 # Apache-2.0
tooz>=0.16.0 # Apache-2.0
Werkzeug>=0.7 # BSD License

View File

@ -25,6 +25,44 @@ setup-hooks =
packages =
aodh
[extras]
mysql =
SQLAlchemy<1.1.0,>=0.9.7
alembic>=0.7.2
PyMySQL>=0.6.2 # MIT License
postgresql =
SQLAlchemy<1.1.0,>=0.9.7
alembic>=0.7.2
psycopg2
mongodb =
pymongo>=3.0.2
hbase =
happybase!=0.7,>=0.5:python_version=='2.7'
# Required for bson
pymongo>=3.0.2
doc =
oslosphinx>=2.5.0 # Apache-2.0
reno>=0.1.1 # Apache2
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
sphinxcontrib-httpdomain
sphinxcontrib-pecanwsme>=0.8
test =
oslotest>=1.5.1 # Apache-2.0
coverage>=3.6
fixtures>=1.3.1
mock>=1.0
testrepository>=0.0.18
testtools>=1.4.0
gabbi>=0.12.0 # Apache-2.0
# Provides subunit-trace
tempest-lib>=0.6.1
python-subunit>=0.0.18
[entry_points]
aodh.storage =
log = aodh.storage.impl_log:Connection

View File

@ -1,27 +0,0 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8
hacking<0.11,>=0.10.0
Babel>=1.3
coverage>=3.6
fixtures>=1.3.1
happybase!=0.7,>=0.5;python_version=='2.7'
mock>=1.0
PyMySQL>=0.6.2 # MIT License
# Docs Requirements
oslosphinx>=2.5.0 # Apache-2.0
reno>=0.1.1 # Apache2
oslotest>=1.5.1 # Apache-2.0
psycopg2
pymongo>=3.0.2
python-subunit>=0.0.18
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
sphinxcontrib-httpdomain
sphinxcontrib-pecanwsme>=0.8
testrepository>=0.0.18
testtools>=1.4.0
gabbi>=0.12.0 # Apache-2.0
# Provides subunit-trace
tempest-lib>=0.6.1

16
tox.ini
View File

@ -4,8 +4,7 @@ skipsdist = True
envlist = py34,py27,pep8
[testenv]
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
deps = .[test]
install_command = pip install -U {opts} {packages}
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
@ -21,25 +20,30 @@ whitelist_externals = bash
# in "py-<backend>" jobs
[testenv:py27-hbase]
deps = .[hbase,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
AODH_TEST_STORAGE_URL=hbase://__test__
[testenv:py27-mongodb]
deps = .[mongodb,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
commands =
bash -x {toxinidir}/setup-test-env-mongodb.sh python setup.py testr --slowest --testr-args="{posargs}"
[testenv:py27-mysql]
deps = .[mysql,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
commands =
bash -x {toxinidir}/setup-test-env-mysql.sh python setup.py testr --slowest --testr-args="{posargs}"
[testenv:py27-pgsql]
deps = .[postgresql,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
commands =
bash -x {toxinidir}/setup-test-env-postgresql.sh python setup.py testr --slowest --testr-args="{posargs}"
[testenv:functional]
deps = .[mysql,postgresql,mongodb,test]
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=aodh/tests/functional/
GABBI_LIVE_FAIL_IF_NO_TEST=1
@ -52,6 +56,7 @@ commands =
# gabbi tests without needing to discovery across the entire body of
# tests.
[testenv:gabbi]
deps = .[mongodb,test]
setenv = OS_TEST_PATH=aodh/tests/functional/gabbi
commands =
bash -x {toxinidir}/setup-test-env-mongodb.sh \
@ -61,22 +66,26 @@ commands =
commands = bash -x {toxinidir}/setup-test-env-mongodb.sh python setup.py testr --slowest --coverage --testr-args="{posargs}"
[testenv:pep8]
deps = hacking<0.11,>=0.10.0
commands =
flake8
# Check that .po and .pot files are valid:
bash -c "find aodh -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
[testenv:releasenotes]
deps = .[doc]
commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:genconfig]
commands = oslo-config-generator --config-file=etc/aodh/aodh-config-generator.conf
[testenv:docs]
deps = .[doc]
commands = python setup.py build_sphinx
setenv = PYTHONHASHSEED=0
[testenv:venv]
deps = .[doc]
commands = {posargs}
setenv = PYTHONHASHSEED=0
@ -84,14 +93,17 @@ setenv = PYTHONHASHSEED=0
commands = bash -x oslo_debug_helper {posargs}
[testenv:debug-mongodb]
deps = .[mongodb,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
commands = bash -x {toxinidir}/setup-test-env-mongodb.sh oslo_debug_helper {posargs}
[testenv:debug-mysql]
deps = .[mysql,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
commands = bash -x {toxinidir}/setup-test-env-mysql.sh oslo_debug_helper {posargs}
[testenv:debug-pgsql]
deps = .[postgresql,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
commands = bash -x {toxinidir}/setup-test-env-postgresql.sh oslo_debug_helper {posargs}