From 0377537dc0b447882a6f98a33fe845c72bd8ab32 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Thu, 23 Aug 2018 08:01:39 +0200 Subject: [PATCH] Create tox.ini file. Configure with minimal requirements for running - pep8 - flake8 verifications py27/py35 - unittests Change-Id: If09bab1f0a8501afddd720cf9ea9335867072e1d --- .gitignore | 11 ++++-- .stestr.conf | 3 ++ pep8-requirements.txt | 6 ++++ test-requirements.txt | 1 + tobiko/plugin.py | 2 ++ tobiko/tests/scenario/base.py | 2 ++ tox.ini | 63 +++++++++++++++++++++++++++++++++++ 7 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 .stestr.conf create mode 100644 pep8-requirements.txt create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index ec972009c..83a8f6f29 100644 --- a/.gitignore +++ b/.gitignore @@ -2,15 +2,20 @@ *.egg *.egg-info *.pyc + +# Hidden files +.eggs +.stestr .test -.stestr* -etc .testrepository .tox .venv + +__pycache__ AUTHORS build/* ChangeLog doc/build/* -zuul/versioninfo dist/ +etc/ +zuul/versioninfo diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..5e8fa6fef --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./tobiko} +top_dir=./ diff --git a/pep8-requirements.txt b/pep8-requirements.txt new file mode 100644 index 000000000..c10070760 --- /dev/null +++ b/pep8-requirements.txt @@ -0,0 +1,6 @@ +# 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. + +flake8==2.5.5 # MIT +flake8-import-order==0.12 # LGPLv3 diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..7690cb706 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +mock >= 2.0 # BSD diff --git a/tobiko/plugin.py b/tobiko/plugin.py index 7276a9f06..03618e88a 100644 --- a/tobiko/plugin.py +++ b/tobiko/plugin.py @@ -11,7 +11,9 @@ # 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 + from tempest import config from tempest.test_discover import plugins diff --git a/tobiko/tests/scenario/base.py b/tobiko/tests/scenario/base.py index 69477b2c5..05c21a6a5 100644 --- a/tobiko/tests/scenario/base.py +++ b/tobiko/tests/scenario/base.py @@ -12,8 +12,10 @@ # 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 subprocess + from tempest.common.utils import net_utils from tempest.lib.common.utils import test_utils diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..01d4f90f9 --- /dev/null +++ b/tox.ini @@ -0,0 +1,63 @@ +[tox] +minversion = 2.0 +envlist = pep8,py35,py27 + + +[testenv] +# usedevelop = True + +install_command = + pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} + +setenv = + VIRTUAL_ENV={envdir} + PYTHONWARNINGS=default::DeprecationWarning,{env:PYTHONWARNINGS:} + OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true} + OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true} + OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true} + +passenv = + +commands = + stestr run {posargs} + +deps = + -r{toxinidir}/test-requirements.txt + + +[testenv:venv] +basepython = python3 + +deps = + +commands = + {posargs} + + +[testenv:pep8] +basepython = python3 + +deps = + -r{toxinidir}/pep8-requirements.txt + +commands = + flake8 + +[flake8] +# E125 continuation line does not distinguish itself from next logical line +# E126 continuation line over-indented for hanging indent +# E128 continuation line under-indented for visual indent +# E129 visually indented line with same indent as next logical line +# E265 block comment should start with '# ' +# H404 multi line docstring should start with a summary +# H405 multi line docstring summary not separated with an empty line +# N530 direct neutron imports not allowed +ignore = E125,E126,E128,E129,E265,H404,H405,N530 + +# H106: Don't put vim configuration in source files +# H203: Use assertIs(Not)None to check for None +# H904: Delay string interpolations at logging calls +enable-extensions = H106,H203,H904 +show-source = true +exclude = ./.*,build,dist,doc,*egg*,releasenotes +import-order-style = pep8