diff --git a/.gitignore b/.gitignore index 0554833f..a35fb11d 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ sdist AUTHORS ChangeLog .tox +doc/build diff --git a/doc/source/conf.py b/doc/source/conf.py index 1fd09e67..0994cf2e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -51,7 +51,7 @@ copyright = u'2013, Jarrod Johnson ' # |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. diff --git a/doc/source/index.rst b/doc/source/index.rst index 0a8b0d66..ab4bac9c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -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 diff --git a/pyghmi/tests/__init__.py b/pyghmi/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pyghmi/tests/unit/__init__.py b/pyghmi/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pyghmi/tests/unit/base.py b/pyghmi/tests/unit/base.py new file mode 100644 index 00000000..5e577e41 --- /dev/null +++ b/pyghmi/tests/unit/base.py @@ -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.""" diff --git a/pyghmi/tests/unit/ipmi/__init__.py b/pyghmi/tests/unit/ipmi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pyghmi/tests/unit/ipmi/test_sdr.py b/pyghmi/tests/unit/ipmi/test_sdr.py new file mode 100644 index 00000000..69cdb86f --- /dev/null +++ b/pyghmi/tests/unit/ipmi/test_sdr.py @@ -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) diff --git a/pyghmi/version.py b/pyghmi/version.py new file mode 100644 index 00000000..557fa4f4 --- /dev/null +++ b/pyghmi/version.py @@ -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') diff --git a/setup.cfg b/setup.cfg index 82541788..e63df42d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/test-requirements.txt b/test-requirements.txt index 94adbad0..b2836194 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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 diff --git a/tox.ini b/tox.ini index 69a75b0a..7da0dda7 100644 --- a/tox.ini +++ b/tox.ini @@ -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