Add basic test and doc infrastructure

- Use testrepository for testing and add a single, very basic test.
- Use the common OpenStack setup to create documentation.

Change-Id: I8987e0ae0829edd26f239a85b6a69e2f529a8932
This commit is contained in:
Thomas Bechtold 2016-02-18 17:03:49 +01:00
parent 754db9b579
commit 92c4d879b2
6 changed files with 155 additions and 2 deletions

8
.testr.conf Normal file
View 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:-60} \
OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \
${PYTHON:-python} -m subunit.run discover -t ./ ./ $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

65
doc/source/conf.py Normal file
View File

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
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
# Add any paths that contain templates here, relative to this directory.
# templates_path = []
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'renderspec'
copyright = u'2016, OpenStack Foundation'
# 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
git_cmd = "git log --pretty=format:'%ad, commit %h' --date=local -n1"
html_last_updated_fmt = os.popen(git_cmd).read()
# 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,
'%s Documentation' % project,
'OpenStack Foundation', 'manual'),
]

38
doc/source/index.rst Normal file
View File

@ -0,0 +1,38 @@
renderspec
==========
`renderspec` is a python program to render RPM spec file templates to a
usable spec file. Distribution specifics like different policies for
package naming in openSUSE or Fedora are handled.
Installation
============
From PyPI
*********
For your convenience, `renderspec` is also available from the Cheese
Shop:
.. code-block:: shell
pip install renderspec
From source
***********
If you want to hack `renderspec` or just have the latest version without
waiting for next release, use the git repo directly a la
.. code-block:: shell
git clone https://git.openstack.org/openstack/renderspec
cd renderspec
python setup.py develop --user
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`

View File

@ -1 +1,7 @@
hacking<0.11,>=0.10.0
flake8
testrepository>=0.0.18
testresources>=0.2.4
testtools>=1.4.0
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0

32
tests.py Normal file
View File

@ -0,0 +1,32 @@
#!/usr/bin/python
# Copyright (c) 2016 SUSE Linux GmbH
#
# 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.
try:
import unittest2 as unittest
except ImportError:
import unittest
import renderspec
class RenderspecTests(unittest.TestCase):
def test_filter_noop(self):
self.assertEqual(renderspec._filter_noop("foobar"), "foobar")
if __name__ == '__main__':
unittest.main()

View File

@ -10,9 +10,9 @@ setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_NOCAPTURE=False
OS_STDERR_NOCAPTURE=False
PYTHONHASHSEED=0
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python setup.py testr --testr-args='{posargs}'
[testenv:pep8]
commands = flake8
@ -22,3 +22,7 @@ commands = {posargs}
[flake8]
exclude = .venv,.git,.tox,dist,doc,*openstack/common/*,*lib/python*,*egg,build
[testenv:docs]
commands = python setup.py build_sphinx