diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..b9ce788 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = mistral_extra + + +[report] +ignore_errors = True diff --git a/.gitignore b/.gitignore index 1422d82..c6c1162 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ pip-log.txt .coverage .tox nosetests.xml +.testrepository AUTHORS # Translations diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000..6d83b3c --- /dev/null +++ b/.testr.conf @@ -0,0 +1,7 @@ +[DEFAULT] +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ + ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/examples/v2/calculator/web_app.py b/examples/v2/calculator/web_app.py index 3dfe8cd..98ac461 100644 --- a/examples/v2/calculator/web_app.py +++ b/examples/v2/calculator/web_app.py @@ -27,14 +27,14 @@ def summ(): try: args_list = flask.json.loads(args).get('arguments') - except: + except Exception: return (403, "Please, specify list of arguments in the request body" " in form '{\"arguments\": [arg1, arg2, .., argN]}'") for a in args_list: try: summ += int(a) - except: + except Exception: return 403, "Sorry, need to use only integer arguments!" return flask.jsonify({'result': summ}) diff --git a/mistral_extra/__init__.py b/mistral_extra/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mistral_extra/tests/__init__.py b/mistral_extra/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mistral_extra/tests/unit/__init__.py b/mistral_extra/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mistral_extra/tests/unit/base.py b/mistral_extra/tests/unit/base.py new file mode 100644 index 0000000..be58475 --- /dev/null +++ b/mistral_extra/tests/unit/base.py @@ -0,0 +1,24 @@ +# Copyright 2017 - 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 oslo_log import log as logging +from oslotest import base + + +LOG = logging.getLogger(__name__) + + +class BaseTest(base.BaseTestCase): + def setUp(self): + super(BaseTest, self).setUp() diff --git a/mistral_extra/tests/unit/test_base.py b/mistral_extra/tests/unit/test_base.py new file mode 100644 index 0000000..08be7aa --- /dev/null +++ b/mistral_extra/tests/unit/test_base.py @@ -0,0 +1,20 @@ +# Copyright 2017 - 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 mistral_extra.tests.unit.base import BaseTest + + +class TestBase(BaseTest): + def test_base(self): + assert True diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..443c2c2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +# 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. + +pbr>=2.0.0 # Apache-2.0 +Babel>=2.3.4 # BSD +oslo.log>=3.11.0 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..090cbcf --- /dev/null +++ b/setup.cfg @@ -0,0 +1,51 @@ +[metadata] +name = mistral-extra +summary = Mistral OpenStack-specific bindings +description-file = + README.rst +license = Apache License, Version 2.0 +author = OpenStack Mistral Team +author-email = openstack-dev@lists.openstack.org +home-page = http://docs.openstack.org/developer/mistral/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + 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 + Programming Language :: Python :: 3.5 + +[files] +packages = + mistral-extra + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/build/html + +[compile_catalog] +directory = mistral-extra/locale +domain = mistral-extra + +[update_catalog] +domain = mistral-extra +output_dir = mistral-extra/locale +input_file = mistral-extra/locale/mistral-extra.pot + +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = mistral-extra/locale/mistral-extra.pot + +[build_releasenotes] +all_files = 1 +build-dir = releasenotes/build +source-dir = releasenotes/source diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..782bb21 --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# 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. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr>=1.8'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..a787e96 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,16 @@ +# 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!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +coverage>=4.0 # Apache-2.0 +python-subunit>=0.0.18 # Apache-2.0/BSD +sphinx>=1.5.1 # BSD +oslosphinx>=4.7.0 # Apache-2.0 +oslotest>=1.10.0 # Apache-2.0 +testrepository>=0.0.18 # Apache-2.0/BSD +testscenarios>=0.4 # Apache-2.0/BSD +testtools>=1.4.0 # MIT + +# releasenotes +reno>=1.8.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..0eb5b23 --- /dev/null +++ b/tox.ini @@ -0,0 +1,39 @@ +[tox] +minversion = 2.0 +envlist = py35,py27,pep8 +skipsdist = True + +[testenv] +usedevelop = True +install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} +deps = -r{toxinidir}/test-requirements.txt +commands = python setup.py test --slowest --testr-args='{posargs}' + +[testenv:pep8] +commands = flake8 {posargs} + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = python setup.py test --coverage --testr-args='{posargs}' + +[testenv:docs] +commands = python setup.py build_sphinx + +[testenv:releasenotes] +commands = + sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + +[testenv:debug] +commands = oslo_debug_helper {posargs} + +[flake8] +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125 +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build