tox: enable unit tests and fix flake8

This patch enables a tox unit tests job, with a few associated
changes:
* In tox.ini, fix broken py27 env by removing pretty_tox.sh and just
  using stestr directly (also remove some cruft).
* De-empty-fy requirements.txt based on imports in the code
* Clean up test-requirements.txt
* Move tempest tests up a level, since the tests subdirectory is for
  unit tests for this project, not tempest tests to run against an
  OpenStack deployment

Change-Id: I2b258c99bb8d624f8f1aac1fd253d91180856a32
This commit is contained in:
Artom Lifshitz 2018-01-08 13:44:19 -05:00
parent fc64781825
commit 3abbb3345a
12 changed files with 55 additions and 26 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ build
.eggs
*.egg-info
.tox
.stestr

View File

@ -1 +1,5 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
oslo.log
tempest

View File

@ -0,0 +1,19 @@
# Copyright 2018 Red Hat
#
# 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 WhiteboxPluginTestCase(base.BaseTestCase):
pass

View File

@ -0,0 +1,24 @@
# Copyright 2018 Red Hat
#
# 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 rhostest_tempest_plugin.tests import base
class PlaceholderTestCase(base.WhiteboxPluginTestCase):
# TODO(artom) Remove this class when we add actual unit tests. This class
# is only necessary to to avoid stestr complaining about not finding any
# tests.
def test_placeholder(self):
pass

View File

@ -1,13 +1,5 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking<0.12,>=0.11.0 # Apache-2.0
# needed for doc build
sphinx!=1.3b1,<1.3,>=1.2.1 # BSD
python-subunit>=0.0.18 # Apache-2.0/BSD
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
reno>=1.8.0 # Apache2
mock>=2.0 # BSD
coverage>=3.6 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
tempest
hacking
oslotest

19
tox.ini
View File

@ -1,12 +1,11 @@
[tox]
envlist = pep8
envlist = flake8,py27
minversion = 2.3.1
skipsdist = True
[testenv]
setenv =
VIRTUAL_ENV={envdir}
passenv = OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_TEST_TIMEOUT OS_TEST_LOCK_PATH TEMPEST_CONFIG TEMPEST_CONFIG_DIR http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
usedevelop = True
install_command = pip install -U {opts} {packages}
whitelist_externals = *
@ -15,22 +14,12 @@ deps =
-r{toxinidir}/test-requirements.txt
commands =
find . -type f -name "*.pyc" -delete
bash tools/pretty_tox.sh '{posargs}'
stestr --test-path ./rhostest_tempest_plugin/tests run {posargs}
[testenv:pep8]
[testenv:flake8]
commands =
flake8 {posargs}
check-uuid
[hacking]
local-check-factory = tempest.hacking.checks.factory
import_exceptions = tempest.services
[flake8]
# E125 is a won't fix until https://github.com/jcrocholl/pep8/issues/126 is resolved. For further detail see https://review.openstack.org/#/c/36788/
# E123 skipped because it is ignored by default in the default pep8
# E129 skipped because it is too limiting when combined with other rules
# Skipped because of new hacking 0.9: H405
ignore = E125,E123,E129
show-source = True
exclude = .git,.venv,.tox,dist,doc,openstack,*egg,test_nova_manage_archive.py
exclude = .git,.venv,.tox,dist,doc,*egg