Add support for tox unit testing

Add support for tox unit testing prior to import into openstack's
gerrit/CI system.
This commit is contained in:
Morgan Fainberg 2016-05-12 08:36:14 -07:00
parent 56597fb23f
commit 6350323b7f
6 changed files with 97 additions and 19 deletions

4
.testr.conf Normal file
View File

@ -0,0 +1,4 @@
[DEFAULT]
test_command=${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./ldappool/tests} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
python-ldap>=2.4:python_version=='2.7' # PSF

36
setup.cfg Normal file
View File

@ -0,0 +1,36 @@
[metadata]
name = ldappool
summary = A simple connector pool for python-ldap.
description-file =
README.rst
author = OpenStack
home-page = https://git.openstack.org/cgit/openstack/ldappool
classifier =
Intended Audience :: Developers
License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
[files]
packages =
ldappool
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1
[upload_sphinx]
upload-dir = doc/build/html
[pbr]
warnerrors = True
autodoc_tree_index_modules = True
autodoc_tree_excludes =
setup.py
ldappool/tests/
[wheel]
universal = 1

View File

@ -33,25 +33,16 @@
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
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:
from setuptools import setup
import multiprocessing # noqa
except ImportError:
from distutils.core import setup
pass
with open('README.rst') as f:
README = f.read()
with open('CHANGES.rst') as f:
CHANGES = f.read()
setup(name='ldappool', version='1.1',
packages=['ldappool', 'ldappool.tests'],
author='Mozilla Services', author_email='services-dev@mozilla.org',
description="A connection pool for python-ldap",
long_description=README + '\n' + CHANGES,
url='https://github.com/mozilla-services/ldappool',
keywords=['python-ldap', 'ldap', 'pool'],
license="MPL")
setuptools.setup(
setup_requires=['pbr>=1.8'],
pbr=True)

5
test_requirements.txt Normal file
View File

@ -0,0 +1,5 @@
# The order of packages is significant, because pip processes them in the order
# of appearance.
hacking<0.11,>=0.10.0
flake8-docstrings==0.2.1.post1

41
tox.ini Normal file
View File

@ -0,0 +1,41 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = py27,pep8,cover,doc
[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_NOCAPTURE=False
OS_STDERR_NOCAPTURE=False
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = find . -type f -name "*.pyc" -delete
python setup.py testr --slowest --testr-args='{posargs}'
whitelist_externals = find
[testenv:pep8]
commands =
flake8
[testenv:venv]
commands = {posargs}
[testenv:cover]
commands = python setup.py testr --coverage --testr-args='{posargs}'
[flake8]
# D100: Missing docstring in public module
# D101: Missing docstring in public class
# D102: Missing docstring in public method
# D103: Missing docstring in public function
# D104: Missing docstring in public package
ignore = D100,D101,D102,D103,D104
show-source = True
exclude = .venv,.tox,dist,doc,*egg,build
[testenv:docs]
commands=
python setup.py build_sphinx