diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 00000000..2109af6c --- /dev/null +++ b/.testr.conf @@ -0,0 +1,4 @@ +[DEFAULT] +test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ./tests $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/refstack/common/tempest_config.py b/refstack/common/tempest_config.py index 660e3f40..a830e31a 100755 --- a/refstack/common/tempest_config.py +++ b/refstack/common/tempest_config.py @@ -100,7 +100,7 @@ class TempestConfig(object): 'debug': True, 'use_stderr': False, 'log_file': 'output', - 'lock_path': '/tmp/'+str(cloud_id)+'/', + 'lock_path': '/tmp/' + str(cloud_id) + '/', 'default_log_levels': """tempest.stress=INFO,amqplib=WARN, sqlalchemy=WARN,boto=WARN,suds=INFO,keystone=INFO, eventlet.wsgi.server=WARN"""} diff --git a/refstack/common/tester.py b/refstack/common/tester.py index 411fa7b7..afb7d121 100755 --- a/refstack/common/tester.py +++ b/refstack/common/tester.py @@ -85,7 +85,7 @@ class TestRepositorySource(object): def run(self): os.getcwd() os.chdir(self.testr_directory) - self._ui.c = self.testr_directory+'tempest.conf' + self._ui.c = self.testr_directory + 'tempest.conf' cmd = run.run(self._ui) @@ -151,7 +151,7 @@ class Tester(object): """ print "starting test" - call([self.test_path+'runtests.sh']) # replace this + call([self.test_path + 'runtests.sh']) # replace this print "finished with tests" # get back the results @@ -184,15 +184,15 @@ test_id_option=--load-list $IDFILE test_list_option=--list group_regex=([^\.]*\.)*""" - with open(path+"runtests.sh", "w") as runtests_script_file: + with open(path + "runtests.sh", "w") as runtests_script_file: runtests_script_file.write(runtests_script) - os.chmod(path+"runtests.sh", 0744) + os.chmod(path + "runtests.sh", 0744) - with open(path+"tempest.conf", "w") as config_file: + with open(path + "tempest.conf", "w") as config_file: config_file.write(self._config) - with open(path+".testr.conf", "w") as testr_config_file: + with open(path + ".testr.conf", "w") as testr_config_file: testr_config_file.write(testr_output) def cancel(self): diff --git a/scripts/import_vendors.py b/scripts/import_vendors.py index ea11abfc..664cd02d 100755 --- a/scripts/import_vendors.py +++ b/scripts/import_vendors.py @@ -31,4 +31,4 @@ with open(_file, 'rb') as csvfile: db.add(vendor) db.commit() except: - print 'vendor skipped:'+row[1] + print 'vendor skipped:' + row[1] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..98125ecd --- /dev/null +++ b/setup.cfg @@ -0,0 +1,28 @@ +[metadata] +name = refstack +version = 0.1 +summary = OpenStack interop testing +description-file = + README.rst +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Environment :: OpenStack + Intended Audience :: Developers + Intended Audience :: Information Technology + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3.3 + +[files] +packages = + refstack + +[global] +setup-hooks = + pbr.hooks.setup_hook + diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..3a372abf --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# Copyright (c) 2014 Piston Cloud Computing, inc. all rights reserved +# +# 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. + +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..e85aaea5 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,7 @@ +pep8==1.4.5 +pyflakes>=0.7.2,<0.7.4 +flake8==2.0 + +python-subunit>=0.0.18 +testrepository>=0.0.18 +testtools>=0.9.34 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 00000000..97037fd8 --- /dev/null +++ b/tests/unit/__init__.py @@ -0,0 +1 @@ +__author__ = 'dlenwell' diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..4e0bfe3b --- /dev/null +++ b/tox.ini @@ -0,0 +1,40 @@ +[tox] +envlist = py26,py27,pep8 +minversion = 1.6 +skipsdist = True + +[testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} +setenv = VIRTUAL_ENV={envdir} + LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=C +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = python setup.py testr --testr-args='{posargs}' +distribute = false + +[testenv:pep8] +commands = flake8 +distribute = false + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = python setup.py testr --coverage --testr-args='{posargs}' + +[tox:jenkins] +downloadcache = ~/cache/pip + +[testenv:docs] +commands = python setup.py build_sphinx + +[flake8] +# E125 continuation line does not distinguish itself from next logical line +# H404 multi line docstring should start with a summary +ignore = E125,H404 +show-source = true +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,build