From 129fd8ca3cb8d89c4e5c7f3236df6d77ad24d82b Mon Sep 17 00:00:00 2001
From: Marc Abramowitz <marc@marc-abramowitz.com>
Date: Fri, 25 Apr 2014 12:37:08 -0700
Subject: [PATCH] Use pbr, pep8 checks & fixes, add "doc" tox target

Change-Id: I1f01e4e5407a8216c7c867c143d15db2037e16d6
---
 .gitignore            |  6 ++++++
 .testr.conf           |  4 ++++
 setup.cfg             | 28 ++++++++++++++++++++++++++++
 setup.py              | 15 ++++-----------
 test-requirements.txt |  6 +++++-
 tox.ini               |  8 ++++++--
 6 files changed, 53 insertions(+), 14 deletions(-)
 create mode 100644 .testr.conf
 create mode 100644 setup.cfg

diff --git a/.gitignore b/.gitignore
index 3c3fcfb..d407c38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,9 @@
 /MANIFEST
 /dist/*
 /doc/build/*
+/.test
+/.testrepository
+/MANIFEST
+/.coverage
+/coverage*.xml
+/junit*.xml
diff --git a/.testr.conf b/.testr.conf
new file mode 100644
index 0000000..5433c07
--- /dev/null
+++ b/.testr.conf
@@ -0,0 +1,4 @@
+[DEFAULT]
+test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} ${PYTHON:-python} -m subunit.run discover -t ./ tests $LISTOPT $IDOPTION
+test_id_option=--load-list $IDFILE
+test_list_option=--list
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..20cfb71
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,28 @@
+[metadata]
+name = python-jenkins
+author = Ken Conley
+author_email = kwc@willowgarage.com
+maintainer = OpenStack
+maintainer_email = openstack@lists.launchpad.net
+description = Python bindings for the remote Jenkins API
+license = BSD
+home-page = http://git.openstack.org/cgit/stackforge/python-jenkins
+classifiers =
+    Environment :: Console
+    Intended Audience :: Developers
+    Intended Audience :: Information Technology
+    License :: OSI Approved :: BSD License
+    Operating System :: OS Independent
+    Programming Language :: Python
+
+[files]
+packages =
+    jenkins
+
+[pbr]
+warnerrors = True
+
+[build_sphinx]
+all_files = 1
+build-dir = doc/build
+source-dir = doc/source
diff --git a/setup.py b/setup.py
index 81e9370..b0bea1e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,12 +1,5 @@
-#!/usr/bin/env python
+import setuptools
 
-from distutils.core import setup
-
-setup(name='python-jenkins',
-      version='0.2.1',
-      description='Python bindings for the remote Jenkins API',
-      author='Ken Conley',
-      author_email='kwc@willowgarage.com',
-      url='http://launchpad.net/python-jenkins',
-      packages=['jenkins'],
-      )
+setuptools.setup(
+    setup_requires=['pbr'],
+    pbr=True)
diff --git a/test-requirements.txt b/test-requirements.txt
index 3cbc320..3217365 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,5 +1,9 @@
 coverage>=3.6
 discover
-flake8
+hacking>=0.5.6,<0.8
 mock
 six
+#unittest2
+python-subunit
+sphinx>=1.1.2,<1.2
+testrepository
diff --git a/tox.ini b/tox.ini
index a5f8ced..00ac095 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,7 +8,7 @@ setenv VIRTUAL_ENV={envdir}
 usedevelop = True
 install_command = pip install {opts} {packages}
 deps = -r{toxinidir}/test-requirements.txt
-commands = python -m discover
+commands = python setup.py testr --slowest --testr-args='{posargs}'
 
 [testenv:cover]
 commands =
@@ -25,11 +25,15 @@ downloadcache = ~/cache/pip
 [testenv:pep8]
 commands = flake8
 
+[testenv:doc]
+commands = python setup.py build_sphinx
+
 [testenv:venv]
 commands = {posargs}
 
 [flake8]
 ; E501 line too long (80 > 79 characters)
-ignore = E501
+; H404 multi line docstring should start with a summary
+ignore = E501,H404
 show-source = True
 exclude = .venv,.tox,dist,doc,build,*.egg