Add packaging and test control files

Need to move the tests back outside of the oslo.test package
because testr complains about importing them from the
wrong place if we don't.

Change-Id: If8e0521dc345f8941f9c7116477549291cf600d2
This commit is contained in:
Doug Hellmann 2014-01-30 13:59:42 -08:00
parent e079880e27
commit 05dc2d8695
14 changed files with 121 additions and 14 deletions

8
.gitignore vendored
View File

@ -3,22 +3,16 @@
*.pyc
*.log
.coverage
requirements.txt
.venv
.tox
cover/
openstack.common.egg-info/
*.egg-info/
.openstack-common-venv/
skeleton.egg-info/
build/
dist/
doc/source/api
AUTHORS
.update-venv/
ChangeLog
openstack/versioninfo
*.egg
openstack/common/db/*.sqlite
.testrepository/
.project
.pydevproject

4
.testr.conf Normal file
View File

@ -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

4
README.rst Normal file
View File

@ -0,0 +1,4 @@
Oslo Test Library
=================
This is the test library provided by Oslo for OpenStack projects.

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
oslo.config

37
setup.cfg Normal file
View File

@ -0,0 +1,37 @@
[metadata]
name = oslo.test
author = OpenStack
author-email = openstack-dev@lists.openstack.org
summary = Oslo Test Library
description-file =
README.rst
home-page = https://launchpad.net/oslo
classifier =
Development Status :: 4 - Beta
Environment :: OpenStack
Intended Audience :: Developers
Intended Audience :: Information Technology
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
[files]
packages =
oslo
oslo.test
namespace_packages =
oslo
[global]
setup-hooks =
pbr.hooks.setup_hook
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1
[upload_sphinx]
upload-dir = doc/build/html

22
setup.py Normal file
View File

@ -0,0 +1,22 @@
#!/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.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)

20
test-requirements.txt Normal file
View File

@ -0,0 +1,20 @@
hacking>=0.8.0,<0.9
discover
fixtures>=0.3.14
python-subunit
testrepository>=0.0.17
testscenarios>=0.4
testtools>=0.9.32
# when we can require tox>= 1.4, this can go into tox.ini:
# [testenv:cover]
# deps = {[testenv]deps} coverage
coverage>=3.6
# this is required for the docs build jobs
sphinx>=1.1.2,<1.2
oslo.sphinx
# mocking framework
mock>=1.0

View File

@ -17,13 +17,13 @@
from oslo.config import cfg
from openstack.common.fixture import config
from tests import utils
from oslo.test import base
from oslo.test.fixture import config
conf = cfg.CONF
class ConfigTestCase(utils.BaseTestCase):
class ConfigTestCase(base.BaseTestCase):
def setUp(self):
super(ConfigTestCase, self).setUp()
self.config = self.useFixture(config.Config(conf)).config

View File

@ -15,8 +15,8 @@
import mock
from openstack.common.fixture import mockpatch
from tests import utils
from oslo.test import base
from oslo.test.fixture import mockpatch
class Foo(object):
@ -28,7 +28,7 @@ def mocking_bar(self):
return 'mocked!'
class TestMockPatch(utils.BaseTestCase):
class TestMockPatch(base.BaseTestCase):
def test_mock_patch_with_replacement(self):
self.useFixture(mockpatch.Patch('%s.Foo.bar' % (__name__),
mocking_bar))
@ -41,7 +41,7 @@ class TestMockPatch(utils.BaseTestCase):
self.assertIsInstance(instance.bar(), mock.MagicMock)
class TestMockPatchObject(utils.BaseTestCase):
class TestMockPatchObject(base.BaseTestCase):
def test_mock_patch_object_with_replacement(self):
self.useFixture(mockpatch.PatchObject(Foo, 'bar', mocking_bar))
instance = Foo()

25
tox.ini Normal file
View File

@ -0,0 +1,25 @@
[tox]
distribute = False
envlist = py26,py27,py33,pep8
[testenv]
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}'
[testenv:pep8]
commands = flake8
[testenv:cover]
setenv = VIRTUAL_ENV={envdir}
commands =
python setup.py testr --coverage
[testenv:venv]
commands = {posargs}
[flake8]
show-source = True
exclude = .tox,dist,doc,*.egg,build
builtins = _