Fix all things tox
This commit fixes all the issues with the tox jobs. I initially wrote this project outside of the openstack infrastructure and played kinda hard and fast with anything from tox. To correct this I need to add sphinx docs, a pro forma test to (and the preresiquite testr boilerplate), and a bunch of random pep8 fixes. Change-Id: I9946fc7db5c030b5860f03b45471f70c1fc4efb1
This commit is contained in:
parent
f2d79631da
commit
59fe450ae9
8
.testr.conf
Normal file
8
.testr.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||||
|
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||||
|
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-500} \
|
||||||
|
OS_TEST_LOCK_PATH=${OS_TEST_LOCK_PATH:-${TMPDIR:-'/tmp'}} \
|
||||||
|
${PYTHON:-python} -m subunit.run discover -t ./ ./germqtt/tests $LISTOPT $IDOPTION
|
||||||
|
test_id_option=--load-list $IDFILE
|
||||||
|
test_list_option=--list
|
74
doc/source/conf.py
Executable file
74
doc/source/conf.py
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# 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 os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.abspath('../..'))
|
||||||
|
# -- General configuration ----------------------------------------------------
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
'oslosphinx',
|
||||||
|
]
|
||||||
|
|
||||||
|
# autodoc generation is a bit aggressive and a nuisance when doing heavy
|
||||||
|
# text edit cycles.
|
||||||
|
# execute "export SPHINX_DEBUG=1" in your terminal to disable
|
||||||
|
|
||||||
|
# The suffix of source filenames.
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = u'germqtt'
|
||||||
|
copyright = u'2016, Matthew Treinish'
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
add_module_names = True
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# -- Options for HTML output --------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||||
|
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||||
|
# html_theme_path = ["."]
|
||||||
|
# html_theme = '_theme'
|
||||||
|
# html_static_path = ['static']
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = '%sdoc' % project
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title, author, documentclass
|
||||||
|
# [howto/manual]).
|
||||||
|
latex_documents = [
|
||||||
|
('index',
|
||||||
|
'%s.tex' % project,
|
||||||
|
u'%s Documentation' % project,
|
||||||
|
u'Matthew Treinish', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Example configuration for intersphinx: refer to the Python standard library.
|
||||||
|
# intersphinx_mapping = {'http://docs.python.org/': None}
|
9
doc/source/index.rst
Normal file
9
doc/source/index.rst
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
germqtt
|
||||||
|
=======
|
||||||
|
|
||||||
|
Contents:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
readme
|
1
doc/source/readme.rst
Normal file
1
doc/source/readme.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
.. include:: ../../README.rst
|
@ -15,14 +15,14 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import ConfigParser
|
|
||||||
import logging
|
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import daemon
|
import daemon
|
||||||
import gerritlib.gerrit
|
import gerritlib.gerrit
|
||||||
import paho.mqtt.publish as publish
|
import paho.mqtt.publish as publish
|
||||||
|
from six.moves import configparser as ConfigParser
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import daemon.pidlockfile
|
import daemon.pidlockfile
|
||||||
@ -36,6 +36,7 @@ except Exception:
|
|||||||
|
|
||||||
log = logging.getLogger('germqtt')
|
log = logging.getLogger('germqtt')
|
||||||
|
|
||||||
|
|
||||||
class GerritStream(object):
|
class GerritStream(object):
|
||||||
|
|
||||||
def __init__(self, user, host, key, thread=True, port=29418):
|
def __init__(self, user, host, key, thread=True, port=29418):
|
||||||
@ -81,6 +82,7 @@ def get_options():
|
|||||||
parser.add_argument('conffile', nargs=1, help="Configuration file")
|
parser.add_argument('conffile', nargs=1, help="Configuration file")
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def get_topic(base_topic, event):
|
def get_topic(base_topic, event):
|
||||||
project = event.get('project', '')
|
project = event.get('project', '')
|
||||||
event_type = event.get('type', '')
|
event_type = event.get('type', '')
|
||||||
|
37
germqtt/tests/base.py
Normal file
37
germqtt/tests/base.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Copyright (c) 2016 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.
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
import fixtures
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
|
||||||
|
class TestCase(testtools.TestCase):
|
||||||
|
|
||||||
|
true = ('True', 'true', '1', 'yes')
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestCase, self).setUp()
|
||||||
|
if os.environ.get('OS_STDOUT_CAPTURE') in self.true:
|
||||||
|
stdout = self.useFixture(fixtures.StringStream('stdout')).stream
|
||||||
|
self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
|
||||||
|
if os.environ.get('OS_STDERR_CAPTURE') in self.true:
|
||||||
|
stderr = self.useFixture(fixtures.StringStream('stderr')).stream
|
||||||
|
self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
|
||||||
|
if (os.environ.get('OS_LOG_CAPTURE') != 'False' and
|
||||||
|
os.environ.get('OS_LOG_CAPTURE') != '0'):
|
||||||
|
self.useFixture(fixtures.LoggerFixture(nuke_handlers=False,
|
||||||
|
level=None))
|
29
germqtt/tests/test_germqtt.py
Normal file
29
germqtt/tests/test_germqtt.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright (c) 2014 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.
|
||||||
|
|
||||||
|
from germqtt import germqtt
|
||||||
|
from germqtt.tests import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestGermqtt(base.TestCase):
|
||||||
|
|
||||||
|
def test_get_topic_with_project(self):
|
||||||
|
base_topic = 'gerrit'
|
||||||
|
event = {
|
||||||
|
'project': 'fake_project',
|
||||||
|
'type': 'fake-type',
|
||||||
|
}
|
||||||
|
full_topic = germqtt.get_topic(base_topic, event)
|
||||||
|
self.assertEqual('gerrit/fake_project/fake-type', full_topic)
|
@ -2,6 +2,7 @@
|
|||||||
# of appearance. Changing the order has an impact on the overall integration
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
pbr>=1.6 # Apache-2.0
|
pbr>=1.6 # Apache-2.0
|
||||||
|
six>=1.9.0 # MIT
|
||||||
paho-mqtt>=1.1
|
paho-mqtt>=1.1
|
||||||
gerritlib>=0.6.0
|
gerritlib>=0.6.0
|
||||||
python-daemon
|
python-daemon
|
||||||
|
@ -5,11 +5,6 @@
|
|||||||
hacking<0.11,>=0.10.2 # Apache-2.0
|
hacking<0.11,>=0.10.2 # Apache-2.0
|
||||||
|
|
||||||
coverage>=3.6 # Apache-2.0
|
coverage>=3.6 # Apache-2.0
|
||||||
discover # BSD
|
|
||||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD
|
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD
|
||||||
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
|
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
|
||||||
oslotest>=1.10.0 # Apache-2.0
|
|
||||||
testscenarios>=0.4 # Apache-2.0/BSD
|
|
||||||
ddt>=1.0.1 # MIT
|
|
||||||
six>=1.9.0 # MIT
|
|
||||||
os-testr>=0.6.0
|
os-testr>=0.6.0
|
||||||
|
2
tox.ini
2
tox.ini
@ -31,6 +31,6 @@ commands = python setup.py build_sphinx
|
|||||||
# E123, E125 skipped as they are invalid PEP-8.
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
|
|
||||||
show-source = True
|
show-source = True
|
||||||
ignore = E123,E125
|
ignore = E123,E125,E129
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
|
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user