diff --git a/setup.py b/setup.py index 1c026183a..66f8b39ca 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ from setuptools import setup, find_packages from packstack import version + # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw @@ -11,14 +12,14 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( - name = "packstack", - version = version.version_string(), - author = "Derek Higgins", - author_email = "derekh@redhat.com", - description = ("A utility to install openstack"), - license = "ASL 2.0", - keywords = "openstack", - url = "https://github.com/fedora-openstack/packstack", + name="packstack", + version=version.version_string(), + author="Derek Higgins", + author_email="derekh@redhat.com", + description=("A utility to install openstack"), + license="ASL 2.0", + keywords="openstack", + url="https://github.com/fedora-openstack/packstack", packages=find_packages('.'), include_package_data=True, long_description=read('README'), @@ -30,4 +31,3 @@ setup( ], scripts=["bin/packstack"] ) - diff --git a/tests/test.py b/tests/test.py new file mode 100644 index 000000000..a9295a8ed --- /dev/null +++ b/tests/test.py @@ -0,0 +1,25 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2013, Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from unittest import TestCase + + +class TestCase(TestCase): + def setUp(self): + pass + + def tearDown(self): + pass diff --git a/tests/test_ospluginutils.py b/tests/test_ospluginutils.py new file mode 100644 index 000000000..4d8e67806 --- /dev/null +++ b/tests/test_ospluginutils.py @@ -0,0 +1,28 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2013, Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from test import TestCase + +from packstack.modules.ospluginutils import gethostlist + + +class OSPluginUtilsTestCase(TestCase): + def test_gethostlist(self): + conf = {"A_HOST": "1.1.1.1", "B_HOSTS": "2.2.2.2,1.1.1.1", + "C_HOSTS": "3.3.3.3/vdc"} + hosts = gethostlist(conf) + hosts.sort() + self.assertEquals(['1.1.1.1', '2.2.2.2', '3.3.3.3'], hosts) diff --git a/tools/pip-requires b/tools/pip-requires new file mode 100644 index 000000000..e69de29bb diff --git a/tools/test-requires b/tools/test-requires new file mode 100644 index 000000000..a6c88f59d --- /dev/null +++ b/tools/test-requires @@ -0,0 +1,2 @@ +nose +coverage diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..058e2a6bf --- /dev/null +++ b/tox.ini @@ -0,0 +1,26 @@ +[tox] +envlist = py26,py27,pep8 + +[testenv] +setenv = VIRTUAL_ENV={envdir} + LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=C + +deps = -r{toxinidir}/tools/pip-requires + -r{toxinidir}/tools/test-requires +commands = nosetests {posargs} + +[tox:jenkins] +sitepackages = True +downloadcache = ~/cache/pip + +[testenv:pep8] +deps=pep8==1.2 +commands = pep8 --exclude=*.pyc --repeat --show-source setup.py + +[testenv:cover] +setenv = NOSE_WITH_COVERAGE=1 + +[testenv:venv] +commands = {posargs}