Add base for unittests and fix docs

Change-Id: Id130e6ea29523fd46ff795be1219016029127945
This commit is contained in:
Lucas Alvares Gomes 2017-01-05 14:52:07 +00:00
parent 2963ecf466
commit de59a8e2e7
12 changed files with 76 additions and 6 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ sdist
AUTHORS
ChangeLog
.tox
doc/build

View File

@ -51,7 +51,7 @@ copyright = u'2013, Jarrod Johnson <jbjohnso@us.ibm.com>'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
from ipmi.version import version_info
from pyghmi.version import version_info
# The full version, including alpha/beta/rc tags.
release = version_info.release_string()
# The short X.Y version.

View File

@ -11,9 +11,9 @@ Contents:
.. toctree::
:maxdepth: 2
.. automodule:: ipmi.command
.. automodule:: pyghmi.ipmi.command
.. autoclass:: ipmi.command
.. autoclass:: pyghmi.ipmi.command
:members:
Indices and tables

0
pyghmi/tests/__init__.py Normal file
View File

View File

21
pyghmi/tests/unit/base.py Normal file
View File

@ -0,0 +1,21 @@
# Copyright 2017 Red Hat, Inc.
# All Rights Reserved.
#
# 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 oslotest import base
class TestCase(base.BaseTestCase):
"""Test case base class for all unit tests."""

View File

View File

@ -0,0 +1,23 @@
# Copyright 2017 Red Hat, Inc.
# All Rights Reserved.
#
# 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 pyghmi.ipmi import sdr
from pyghmi.tests.unit import base
class SDRTestCase(base.TestCase):
def test_ones_complement(self):
self.assertEqual(sdr.ones_complement(127, 8), 127)

18
pyghmi/version.py Normal file
View File

@ -0,0 +1,18 @@
# Copyright 2017 Red Hat, Inc.
# All Rights Reserved.
#
# 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 pbr.version
version_info = pbr.version.VersionInfo('pyghmi')

View File

@ -16,6 +16,11 @@ classifier =
Programming Language :: Python :: 2.7
Programming Language :: Python :: 2.6
[build_sphinx]
all_files = 1
build-dir = doc/build
source-dir = doc/source
[files]
packages =
pyghmi

View File

@ -8,3 +8,5 @@ sphinx>=1.1.2
testrepository>=0.0.17
testscenarios>=0.4
testtools>=0.9.32
os-testr>=0.8.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0

View File

@ -1,15 +1,15 @@
[tox]
envlist = py34,py27,pep8
envlist = py35,py27,pep8
[testenv]
setenv = VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
TESTS_DIR=./pyghmi/tests/unit/
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
python setup.py testr --slowest --testr-args='{posargs}'
commands = ostestr {posargs}
[tox:jenkins]
sitepackages = True