From 49c060a313013a7733697cd30648fa3985b6e4f6 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 28 Mar 2013 02:37:45 +0100 Subject: [PATCH] Migrate to pbr and testr. --- .gitignore | 5 +++++ .testr.conf | 4 ++++ requirements.txt | 2 ++ run_tests.sh | 3 +-- setup.cfg | 34 ++++++++++++++++++++++++++++++++++ setup.py | 41 +++++++++++++++++++---------------------- test-requirements.txt | 8 ++++++++ tox.ini | 31 +++++++++++++++++++++++++++++++ 8 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 .testr.conf create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index d2d6f36..9156a66 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ pip-log.txt # Unit test / coverage reports .coverage +.testrepository .tox nosetests.xml @@ -33,3 +34,7 @@ nosetests.xml .mr.developer.cfg .project .pydevproject + +# OpenStack Generated Files +AUTHORS +ChangeLog diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000..1641f86 --- /dev/null +++ b/.testr.conf @@ -0,0 +1,4 @@ +[DEFAULT] +test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 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/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4283556 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +anyjson +pystache diff --git a/run_tests.sh b/run_tests.sh index 123a2b3..053148f 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,2 +1 @@ -flake8 --verbose `find . -name '*.py'` -nosetests +tox diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1ee4b4b --- /dev/null +++ b/setup.cfg @@ -0,0 +1,34 @@ +[metadata] +name = os-config-applier +author = OpenStack +author-email = openstack-dev@lists.openstack.org +summary = OpenStack configuration from cloud metadata +description-file = + README.md +home-page = http://github.com/tripleo/os-config-applier +classifier = + Development Status :: 4 - Beta + Environment :: Console + Environment :: OpenStack + Intended Audience :: Developers + Intended Audience :: Information Technology + License :: OSI Approved :: Apache Software License + Operating System :: OS Independent + Programming Language :: Python + +[files] +packages = + os_config_applier + +[global] +setup-hooks = + pbr.hooks.setup_hook + +[entry_points] +console_scripts = + os-config-applier = os_config_applier.os_config_applier:main + +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 diff --git a/setup.py b/setup.py index 959c623..59a0090 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,21 @@ -try: - from setuptools import setup -except ImportError: - from distutils.core import setup +#!/usr/bin/env python +# 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. -config = { - 'name': 'os-config-applier', - 'description': 'applies configuration from cloud metadata.', - 'author': 'echohead', - 'author_email': 'tim.miller.0@gmail.com', - 'url': 'http://github.com/tripleo/os-config-applier', - 'version': '0.3', - 'install_requires': ['nose'], - 'packages': ['os_config_applier'], - 'scripts': [], - 'install_requires': ['pystache', 'anyjson'], -# 'long_description': open('README.md').read(), - 'entry_points': { - 'console_scripts': [ - 'os-config-applier = os_config_applier.os_config_applier:main'] - } -} +import setuptools -setup(**config) +setuptools.setup( + setup_requires=['d2to1', 'pbr'], + d2to1=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..ea2a580 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,8 @@ +coverage>=3.6 +discover +fixtures>=0.3.12 +python-subunit +sphinx>=1.1.2 +testrepository>=0.0.13 +testscenarios +testtools>=0.9.27 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..ef50d55 --- /dev/null +++ b/tox.ini @@ -0,0 +1,31 @@ +[tox] +envlist = py27,pep8 + +[testenv] +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 --slowest --testr-args='{posargs}' + +[tox:jenkins] +sitepackages = True +downloadcache = ~/cache/pip + +[testenv:pep8] +commands = flake8 + +[testenv:cover] +setenv = VIRTUAL_ENV={envdir} +commands = + python setup.py testr --coverage + +[testenv:venv] +commands = {posargs} + +[flake8] +exclude = .venv,.tox,dist,doc,*.egg +show-source = true