Make it possible for openstack-CI to run tests

Per http://wiki.openstack.org/ProjectTestingInterface we enable all
of the commands except build_sphinx because we do not have any sphinx
documentation as of yet. Includes babel support though there are no
properly internationalized strings just yet.

Change-Id: Iae6e6b3f9e605106f4575196fa5527d2187255df
This commit is contained in:
Clint Byrum 2013-01-24 09:42:57 -08:00
parent 3d95bf81c5
commit c3ee071d73
12 changed files with 162 additions and 8 deletions

3
.gitignore vendored
View File

@ -2,3 +2,6 @@
.testrepository .testrepository
*.swp *.swp
*.pyc *.pyc
.tox
*.egg-info
dist

7
MANIFEST.in Normal file
View File

@ -0,0 +1,7 @@
recursive-include lib
include bin/disk-image-create
include bin/disk-image-get-kernel
include bin/ramdisk-image-create
recursive-include elements
include README.md
recursive-include docs

1
babel.cfg Normal file
View File

@ -0,0 +1 @@
[python: **.py]

View File

@ -86,6 +86,5 @@ def main(argv):
print(' '.join(expand_dependencies(args.elements))) print(' '.join(expand_dependencies(args.elements)))
return 0 return 0
sys.stderr.write("ERROR: please choose an option.\n") sys.stderr.write("ERROR: please choose an option.\n")
return -1 return -1

View File

@ -0,0 +1,20 @@
# Translations template for configapplier.
# Copyright (C) 2013 ORGANIZATION
# This file is distributed under the same license as the configapplier
# project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: configapplier 0.0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-01-24 09:27-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"

View File

@ -0,0 +1,20 @@
# English translations for configapplier.
# Copyright (C) 2013 ORGANIZATION
# This file is distributed under the same license as the configapplier
# project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
#
msgid ""
msgstr ""
"Project-Id-Version: configapplier 0.0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-01-24 09:27-0800\n"
"PO-Revision-Date: 2013-01-24 09:41-0800\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: en <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"

View File

@ -20,7 +20,9 @@ from fixtures import Fixture, TempDir
from diskimage_builder.elements import expand_dependencies from diskimage_builder.elements import expand_dependencies
data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'test-elements')) data_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), 'test-elements'))
def _populate_element(element_dir, element_name, element_deps=[]): def _populate_element(element_dir, element_name, element_deps=[]):
element_home = os.path.join(element_dir, element_name) element_home = os.path.join(element_dir, element_name)
@ -29,6 +31,7 @@ def _populate_element(element_dir, element_name, element_deps=[]):
with open(deps_path, 'w') as deps_file: with open(deps_path, 'w') as deps_file:
deps_file.write("\n".join(element_deps)) deps_file.write("\n".join(element_deps))
class TestElementDeps(TestCase): class TestElementDeps(TestCase):
def setUp(self): def setUp(self):

View File

@ -17,7 +17,10 @@ import os
import sys import sys
import unittest import unittest
class StubPackage: pass
class StubPackage:
pass
# conceptually load_tests should be in __init__, but see # conceptually load_tests should be in __init__, but see
# http://bugs.python.org/issue16662 instead. So, its here in test_elements.py # http://bugs.python.org/issue16662 instead. So, its here in test_elements.py

13
setup.cfg Normal file
View File

@ -0,0 +1,13 @@
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = diskimage_builder/locale/diskimage_builder.pot
[update_catalog]
domain = diskimage_builder
output_dir = diskimage_builder/locale
input_file = diskimage_builder/locale/diskimage_builder.pot
[compile_catalog]
directory = diskimage_builder/locale
domain = diskimage_builder

40
setup.py Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/python
#
# 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
with open("README.md", 'rt') as readme:
readme_text = readme.read()
setuptools.setup(
name='diskimage_builder',
version='0.0.1',
description="""Build Disk Images for use on OpenStack Nova""",
long_description = readme_text,
license='Apache License (2.0)',
author='HP Cloud Services',
author_email='nobody@hp.com',
url='https://github.com/stackforge/diskimage-builder',
packages=setuptools.find_packages(),
include_package_data=True,
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.7',
'Environment :: Console',
],
scripts=['bin/element-info'],
py_modules=[])

2
tools/test-requires Normal file
View File

@ -0,0 +1,2 @@
testtools
fixtures

43
tox.ini Normal file
View File

@ -0,0 +1,43 @@
[tox]
envlist = py26,py27,pep8
[testenv]
setenv = LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
deps=
testtools
testrepository
coverage
babel
commands=
bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi'
bash -c 'testr run --parallel {posargs} ; RET=$? echo "Slowest Tests" ; testr slowest && exit $RET'
[testenv:py26]
deps=
testtools
testrepository
coverage
babel
discover
argparse
[pep8]
ignore = E125
[testenv:pep8]
deps = pep8
commands =
pep8 --repeat --show-source --exclude=.venv,.tox,doc .
[testenv:venv]
commands = {posargs}
[testenv:cover]
setenv = PYTHON=coverage run --source diskimage_builder
commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi'
bash -c 'testr run --parallel ; RET=$? ; coverage combine ; coverage html -d ./cover $OMIT && exit $RET'
[tox:jenkins]
downloadcache = ~/cache/pip