From d23b325704ad9f53e927a02db30ea23f210a637b Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Mon, 10 Nov 2014 16:32:00 -0500 Subject: [PATCH] Merge with code generated using OpenStack cookie-cutter Adjust imports, requirements etc to get py27 and pep8 working Co-Authored-By: Digambar Patil Co-Authored-By: Steven Dake Change-Id: I23f9afc2b3039f03f9db58bc502f348c4943fdf0 --- .coveragerc | 7 +++ .gitignore | 57 ++++++++++++------------- .mailmap | 3 ++ .testr.conf | 7 +++ CONTRIBUTING.rst | 17 ++++++++ HACKING.rst | 4 ++ LICENSE | 1 + MANIFEST.in | 6 +++ README.md | 4 -- README.rst | 15 +++++++ babel.cfg | 2 + doc/source/conf.py | 75 +++++++++++++++++++++++++++++++++ doc/source/contributing.rst | 4 ++ doc/source/index.rst | 25 +++++++++++ doc/source/installation.rst | 12 ++++++ doc/source/readme.rst | 1 + doc/source/usage.rst | 7 +++ magnum/__init__.py | 5 +++ magnum/api/app.py | 19 +++++++-- magnum/api/controllers/root.py | 15 ++++++- magnum/api/controllers/v1.py | 52 ++++++++++++++--------- magnum/api/model/__init__.py | 15 ++++++- magnum/config.py | 6 +-- magnum/tests/__init__.py | 28 +++++++++--- magnum/tests/base.py | 23 ++++++++++ magnum/tests/config.py | 16 ++++++- magnum/tests/test_functional.py | 30 +++++++------ magnum/tests/test_magnum.py | 28 ++++++++++++ magnum/tests/test_units.py | 16 ++++++- magnum/version.py | 2 +- openstack-common.conf | 6 +++ requirements.txt | 8 +++- setup.cfg | 11 +++-- setup.py | 8 ---- test-requirements.txt | 16 +++++-- tox.ini | 26 ++++++------ 36 files changed, 457 insertions(+), 120 deletions(-) create mode 100644 .coveragerc create mode 100644 .mailmap create mode 100644 .testr.conf create mode 100644 CONTRIBUTING.rst create mode 100644 HACKING.rst create mode 100644 MANIFEST.in delete mode 100644 README.md create mode 100644 README.rst create mode 100644 babel.cfg create mode 100755 doc/source/conf.py create mode 100644 doc/source/contributing.rst create mode 100644 doc/source/index.rst create mode 100644 doc/source/installation.rst create mode 100644 doc/source/readme.rst create mode 100644 doc/source/usage.rst create mode 100644 magnum/tests/base.py create mode 100644 magnum/tests/test_magnum.py create mode 100644 openstack-common.conf diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000..68e128226c --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = magnum +omit = magnum/tests/*,magnum/openstack/* + +[report] +ignore-errors = True diff --git a/.gitignore b/.gitignore index 51cbe85254..8a3c704293 100644 --- a/.gitignore +++ b/.gitignore @@ -1,38 +1,32 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ *.py[cod] # C extensions *.so -# Distribution / packaging -.Python -env/ -bin/ -build/ -develop-eggs/ -dist/ -eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg +# Packages *.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 # Installer logs pip-log.txt -pip-delete-this-directory.txt # Unit test / coverage reports -htmlcov/ -.tox/ .coverage -.cache +.tox nosetests.xml -coverage.xml +.testrepository +.venv # Translations *.mo @@ -42,13 +36,18 @@ coverage.xml .project .pydevproject -# Rope -.ropeproject +# Complexity +output/*.html +output/*/index.html -# Django stuff: -*.log -*.pot +# Sphinx +doc/build -# Sphinx documentation -docs/_build/ +# pbr generates these +AUTHORS +ChangeLog +# Editors +*~ +.*.swp +.*sw? diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000..516ae6fe01 --- /dev/null +++ b/.mailmap @@ -0,0 +1,3 @@ +# Format is: +# +# diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000000..6d83b3c4ec --- /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/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000000..330220ed7b --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,17 @@ +If you would like to contribute to the development of OpenStack, +you must follow the steps in the "If you're a developer, start here" +section of this page: + + http://wiki.openstack.org/HowToContribute + +Once those steps have been completed, changes to OpenStack +should be submitted for review via the Gerrit tool, following +the workflow documented at: + + http://wiki.openstack.org/GerritWorkflow + +Pull requests submitted through GitHub will be ignored. + +Bugs should be filed on Launchpad, not GitHub: + + https://bugs.launchpad.net/magnum diff --git a/HACKING.rst b/HACKING.rst new file mode 100644 index 0000000000..f30ceffd6f --- /dev/null +++ b/HACKING.rst @@ -0,0 +1,4 @@ +magnum Style Commandments +=============================================== + +Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ diff --git a/LICENSE b/LICENSE index 67db858821..68c771a099 100644 --- a/LICENSE +++ b/LICENSE @@ -173,3 +173,4 @@ defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..c978a52dae --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS +include ChangeLog +exclude .gitignore +exclude .gitreview + +global-exclude *.pyc diff --git a/README.md b/README.md deleted file mode 100644 index 51bc372449..0000000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -openstack-containers -==================== - -This is the new Openstack project for containers. diff --git a/README.rst b/README.rst new file mode 100644 index 0000000000..4e88263066 --- /dev/null +++ b/README.rst @@ -0,0 +1,15 @@ +=============================== +magnum +=============================== + +new Openstack project for containers. + +* Free software: Apache license +* Documentation: http://docs.openstack.org/developer/magnum +* Source: http://git.openstack.org/cgit/stackforge/magnum +* Bugs: http://bugs.launchpad.net/magnum + +Features +-------- + +* TODO diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000000..15cd6cb76b --- /dev/null +++ b/babel.cfg @@ -0,0 +1,2 @@ +[python: **.py] + diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100755 index 0000000000..615e2607ba --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# 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 os +import sys + +sys.path.insert(0, os.path.abspath('../..')) +# -- General configuration ---------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', + #'sphinx.ext.intersphinx', + 'oslosphinx' +] + +# autodoc generation is a bit aggressive and a nuisance when doing heavy +# text edit cycles. +# execute "export SPHINX_DEBUG=1" in your terminal to disable + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'magnum' +copyright = u'2013, OpenStack Foundation' + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# -- Options for HTML output -------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +# html_theme_path = ["."] +# html_theme = '_theme' +# html_static_path = ['static'] + +# Output file base name for HTML help builder. +htmlhelp_basename = '%sdoc' % project + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass +# [howto/manual]). +latex_documents = [ + ('index', + '%s.tex' % project, + u'%s Documentation' % project, + u'OpenStack Foundation', 'manual'), +] + +# Example configuration for intersphinx: refer to the Python standard library. +#intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst new file mode 100644 index 0000000000..1728a61ca2 --- /dev/null +++ b/doc/source/contributing.rst @@ -0,0 +1,4 @@ +============ +Contributing +============ +.. include:: ../../CONTRIBUTING.rst diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000000..1193fe1c2a --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,25 @@ +.. magnum documentation master file, created by + sphinx-quickstart on Tue Jul 9 22:26:36 2013. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to magnum's documentation! +======================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + readme + installation + usage + contributing + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/source/installation.rst b/doc/source/installation.rst new file mode 100644 index 0000000000..9c0443d174 --- /dev/null +++ b/doc/source/installation.rst @@ -0,0 +1,12 @@ +============ +Installation +============ + +At the command line:: + + $ pip install magnum + +Or, if you have virtualenvwrapper installed:: + + $ mkvirtualenv magnum + $ pip install magnum diff --git a/doc/source/readme.rst b/doc/source/readme.rst new file mode 100644 index 0000000000..a6210d3d8a --- /dev/null +++ b/doc/source/readme.rst @@ -0,0 +1 @@ +.. include:: ../../README.rst diff --git a/doc/source/usage.rst b/doc/source/usage.rst new file mode 100644 index 0000000000..03c14efb09 --- /dev/null +++ b/doc/source/usage.rst @@ -0,0 +1,7 @@ +======== +Usage +======== + +To use magnum in a project:: + + import magnum diff --git a/magnum/__init__.py b/magnum/__init__.py index 9668c8896b..222507a6cf 100644 --- a/magnum/__init__.py +++ b/magnum/__init__.py @@ -12,6 +12,11 @@ import threading +import pbr.version + + +__version__ = pbr.version.VersionInfo( + 'magnum').version_string() # Make a project global TLS trace storage repository TLS = threading.local() diff --git a/magnum/api/app.py b/magnum/api/app.py index 1c61c1ee05..a342061503 100644 --- a/magnum/api/app.py +++ b/magnum/api/app.py @@ -1,5 +1,18 @@ -from pecan import make_app -from api import model +# 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 pecan + +from magnum.api import model def setup_app(config): @@ -7,7 +20,7 @@ def setup_app(config): model.init_model() app_conf = dict(config.app) - return make_app( + return pecan.make_app( app_conf.pop('root'), logging=getattr(config, 'logging', {}), **app_conf diff --git a/magnum/api/controllers/root.py b/magnum/api/controllers/root.py index 606bd014e6..d0a85c674c 100644 --- a/magnum/api/controllers/root.py +++ b/magnum/api/controllers/root.py @@ -1,5 +1,16 @@ -from pecan import expose, redirect -from api.controllers import v1 +# 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 magnum.api.controllers import v1 class RootController(object): diff --git a/magnum/api/controllers/v1.py b/magnum/api/controllers/v1.py index cb2597b80f..c65c84d7ad 100644 --- a/magnum/api/controllers/v1.py +++ b/magnum/api/controllers/v1.py @@ -1,24 +1,34 @@ +# 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 ast -import base64 -import copy -import datetime import functools import inspect -import json import uuid -import pecan -import wsme -from oslo.config import cfg -from oslo.utils import netutils + from oslo.utils import strutils from oslo.utils import timeutils +import pecan +from pecan import rest +import six +import wsme +from wsme import exc from wsme import types as wtypes import wsmeext.pecan as wsme_pecan -from pecan import rest, response -import six +# NOTE(dims): We don't depend on oslo*i18n yet +_ = _LI = _LW = _LE = _LC = lambda x: x + state_kind = ["ok", "containers", "insufficient data"] state_kind_enum = wtypes.Enum(str, *state_kind) operation_kind = ('lt', 'le', 'eq', 'ne', 'ge', 'gt') @@ -128,17 +138,17 @@ class Query(_Base): msg = (_('Unable to convert the value %(value)s' ' to the expected data type %(type)s.') % {'value': self.value, 'type': type}) - raise ClientSideError(msg) + raise exc.ClientSideError(msg) except TypeError: msg = (_('The data type %(type)s is not supported. The supported' ' data type list is: %(supported)s') % {'type': type, 'supported': self._supported_types}) - raise ClientSideError(msg) + raise exc.ClientSideError(msg) except Exception: msg = (_('Unexpected exception converting %(value)s to' ' the expected data type %(type)s.') % {'value': self.value, 'type': type}) - raise ClientSideError(msg) + raise exc.ClientSideError(msg) return converted_value @@ -165,24 +175,24 @@ class ContainerController(rest.RestController): @wsme_pecan.wsexpose([Container], [Query], int) def get_all(self, q=None, limit=None): - # TODO: Returns all the containers - response.status = 200 + # TODO(dims): Returns all the containers + pecan.response.status = 200 return @wsme_pecan.wsexpose(Container, wtypes.text) def get_one(self, container_id): - # TODO: Returns all the containers - response.status = 200 + # TODO(dims): Returns all the containers + pecan.response.status = 200 return @wsme_pecan.wsexpose([Container], body=[Container]) def post(self, data): - # TODO: Create a new container - response.status = 201 + # TODO(dims): Create a new container + pecan.response.status = 201 return @wsme_pecan.wsexpose(None, status_code=204) def delete(self): - # TODO: DELETE the containers - response.status = 204 + # TODO(dims): DELETE the containers + pecan.response.status = 204 return diff --git a/magnum/api/model/__init__.py b/magnum/api/model/__init__.py index d983f7bc51..9c177bcb0e 100644 --- a/magnum/api/model/__init__.py +++ b/magnum/api/model/__init__.py @@ -1,9 +1,20 @@ +# 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 pecan import conf # noqa def init_model(): - """ - This is a stub method which is called at application startup time. + """This is a stub method which is called at application startup time. If you need to bind to a parsed database configuration, set up tables or ORM classes, or perform any database initialization, this is the diff --git a/magnum/config.py b/magnum/config.py index 1b33f63b07..bb33daabfc 100644 --- a/magnum/config.py +++ b/magnum/config.py @@ -16,11 +16,11 @@ from oslo.config import cfg -from solum import version +from magnum import version def parse_args(argv, default_config_files=None): cfg.CONF(argv[1:], - project='solum', - version=version.version_string(), + project='magnum', + version=version.version_string, default_config_files=default_config_files) diff --git a/magnum/tests/__init__.py b/magnum/tests/__init__.py index 78ea5274f8..0284ec9da2 100644 --- a/magnum/tests/__init__.py +++ b/magnum/tests/__init__.py @@ -1,22 +1,36 @@ +# 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 os -from unittest import TestCase -from pecan import set_config -from pecan.testing import load_test_app +import unittest + +import pecan +from pecan import testing __all__ = ['FunctionalTest'] -class FunctionalTest(TestCase): - """ +class FunctionalTest(unittest.TestCase): + """Functional tests + Used for functional tests where you need to test your literal application and its integration with the framework. """ def setUp(self): - self.app = load_test_app(os.path.join( + self.app = testing.load_test_app(os.path.join( os.path.dirname(__file__), 'config.py' )) def tearDown(self): - set_config({}, overwrite=True) + pecan.set_config({}, overwrite=True) diff --git a/magnum/tests/base.py b/magnum/tests/base.py new file mode 100644 index 0000000000..1c30cdb56e --- /dev/null +++ b/magnum/tests/base.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# Copyright 2010-2011 OpenStack Foundation +# 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. + +from oslotest import base + + +class TestCase(base.BaseTestCase): + + """Test case base class for all unit tests.""" diff --git a/magnum/tests/config.py b/magnum/tests/config.py index be4b70c8c6..d1d674259d 100644 --- a/magnum/tests/config.py +++ b/magnum/tests/config.py @@ -1,3 +1,15 @@ +# 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. + # Server Specific Configurations server = { 'port': '8080', @@ -6,8 +18,8 @@ server = { # Pecan Application Configurations app = { - 'root': 'api.controllers.root.RootController', - 'modules': ['api'], + 'root': 'magnum.api.controllers.root.RootController', + 'modules': ['magnum.api'], 'static_root': '%(confdir)s/../../public', 'template_path': '%(confdir)s/../templates', 'debug': True, diff --git a/magnum/tests/test_functional.py b/magnum/tests/test_functional.py index 32e9f41410..794d82b2a2 100644 --- a/magnum/tests/test_functional.py +++ b/magnum/tests/test_functional.py @@ -1,22 +1,24 @@ -from unittest import TestCase -from webtest import TestApp -from api.tests import FunctionalTest +# 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 magnum import tests -class TestRootController(FunctionalTest): +class TestRootController(tests.FunctionalTest): - def test_get(self): - response = self.app.get('/') + def test_get_all(self): + response = self.app.get('/v1/containers') assert response.status_int == 200 - def test_search(self): - response = self.app.post('/', params={'q': 'RestController'}) - assert response.status_int == 302 - assert response.headers['Location'] == ( - 'http://pecan.readthedocs.org/en/latest/search.html' - '?q=RestController' - ) - def test_get_not_found(self): response = self.app.get('/a/bogus/url', expect_errors=True) assert response.status_int == 404 diff --git a/magnum/tests/test_magnum.py b/magnum/tests/test_magnum.py new file mode 100644 index 0000000000..8173a921e7 --- /dev/null +++ b/magnum/tests/test_magnum.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +# 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. + +""" +test_magnum +---------------------------------- + +Tests for `magnum` module. +""" + +from magnum.tests import base + + +class TestMagnum(base.TestCase): + + def test_something(self): + pass diff --git a/magnum/tests/test_units.py b/magnum/tests/test_units.py index 573fb682f8..75a76d6a4c 100644 --- a/magnum/tests/test_units.py +++ b/magnum/tests/test_units.py @@ -1,7 +1,19 @@ -from unittest import TestCase +# 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 unittest -class TestUnits(TestCase): +class TestUnits(unittest.TestCase): def test_units(self): assert 5 * 5 == 25 diff --git a/magnum/version.py b/magnum/version.py index 52705fa39d..c9a048cfbf 100644 --- a/magnum/version.py +++ b/magnum/version.py @@ -17,5 +17,5 @@ import pbr.version -version_info = pbr.version.VersionInfo('solum') +version_info = pbr.version.VersionInfo('magnum') version_string = version_info.version_string diff --git a/openstack-common.conf b/openstack-common.conf new file mode 100644 index 0000000000..4c0bfaa747 --- /dev/null +++ b/openstack-common.conf @@ -0,0 +1,6 @@ +[DEFAULT] + +# The list of modules to copy from oslo-incubator.git + +# The base module to hold the copy of openstack.common +base=magnum diff --git a/requirements.txt b/requirements.txt index 0363f5b143..915fc3ce6e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,12 @@ +# 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>=0.6,!=0.7,<1.0 +Babel>=1.3 + oslo.config>=1.2.1 oslo.utils>=1.0.0 -pbr>=0.6,!=0.7,<1.0 pecan>=0.5.0 python-keystoneclient>=0.9.0 python-zaqarclient>=0.0.3 diff --git a/setup.cfg b/setup.cfg index c387a63a47..fe941dff52 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,8 @@ [metadata] name = magnum -version = 0.0.1 -summary = Application Lifecycle Management for OpenStack +summary = Container Management project for OpenStack description-file = - README.md + README.rst author = OpenStack author-email = openstack-dev@lists.openstack.org home-page = http://www.openstack.org/ @@ -19,6 +18,7 @@ classifier = Programming Language :: Python :: 2.6 Programming Language :: Python :: 3 Programming Language :: Python :: 3.3 + Programming Language :: Python :: 3.4 [files] packages = @@ -41,5 +41,10 @@ domain = magnum output_dir = magnum/locale input_file = magnum/locale/magnum.pot +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = magnum/locale/magnum.pot + [wheel] universal = 1 diff --git a/setup.py b/setup.py index 736375744d..70c2b3f32b 100644 --- a/setup.py +++ b/setup.py @@ -17,14 +17,6 @@ # 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'], pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index 8a7c71efc5..eb777c72b0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,10 +1,18 @@ +# 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.9.2,<0.10 + coverage>=3.6 +discover fixtures>=0.3.14 -python-subunit>=0.0.18 -oslotest +mock>=1.0 +nose +python-subunit +sphinx>=1.1.2 +oslosphinx +oslotest>=1.1.0.0a1 testrepository>=0.0.18 testscenarios>=0.4 testtools>=0.9.34 -mock>=1.0 -nose diff --git a/tox.ini b/tox.ini index fa9237ffd1..93935fa571 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 1.6 -envlist = py26,py27,py33,py34,pypy,pep8 +envlist = py33,py34,py26,py27,pypy,pep8 skipsdist = True [testenv] @@ -13,25 +13,23 @@ deps = -r{toxinidir}/requirements.txt commands = python setup.py testr --slowest --testr-args='{posargs}' [testenv:pep8] -commands = - flake8 - {toxinidir}/tools/config/check_uptodate.sh - {toxinidir}/tools/check_for_alembic_branches.sh +commands = flake8 [testenv:venv] commands = {posargs} [testenv:cover] -commands = ./coverage.sh {posargs} +commands = python setup.py testr --coverage --testr-args='{posargs}' + +[testenv:docs] +commands = python setup.py build_sphinx [flake8] # H803 skipped on purpose per list discussion. -# E123, E125 skipped as they are invalid PEP-8. +# E125 is deliberately excluded. See https://github.com/jcrocholl/pep8/issues/126 +# The rest of the ignores are TODOs +# New from hacking 0.9: E129, E131, H407, H405, H904 +# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301 -show-source = True -ignore = E123,E125,H803 -builtins = _ -exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build - -[hacking] -import_exceptions = solum.openstack.common.gettextutils._ +ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405,H803,H904 +exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools