diff --git a/.gitignore b/.gitignore index bd9a7d9..2af135d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,58 +1,31 @@ -*.py[cod] - -# C extensions -*.so - -# Packages -*.egg -*.egg-info -dist -build -.eggs -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg -lib -lib64 - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox -nosetests.xml -.testrepository -.venv -.stestr/ - -# Translations -*.mo - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# Complexity -output/*.html -output/*/index.html - -# Sphinx -doc/build - -# pbr generates these AUTHORS +build/* +build-stamp ChangeLog - -# Editors +cover/ +covhtml/ +dist/ +doc/build +etc/*.sample +*.DS_Store +*.pyc +vmware_nsx.egg-info/ +pbr*.egg/ +run_tests.err.log +run_tests.log +setuptools*.egg/ +subunit.log +*.mo +*.sw? *~ -.*.swp -.*sw? +/.* +!/.coveragerc +!/.gitignore +!/.gitreview +!/.mailmap +!/.pylintrc +!/.testr.conf +!/.zuul.yaml -# Reno +# Files created by releasenotes build releasenotes/build diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..ae644cd --- /dev/null +++ b/.pylintrc @@ -0,0 +1,142 @@ +# The format of this file isn't really documented; just use --generate-rcfile +[MASTER] +# Add to the black list. It should be a base name, not a +# path. You may set this option multiple times. +# +# Note the 'openstack' below is intended to match only +# neutron.openstack.common. If we ever have another 'openstack' +# dirname, then we'll need to expand the ignore features in pylint :/ +ignore=.git,tests,openstack + +[MESSAGES CONTROL] +# NOTE(gus): This is a long list. A number of these are important and +# should be re-enabled once the offending code is fixed (or marked +# with a local disable) +disable= +# "F" Fatal errors that prevent further processing + import-error, +# "I" Informational noise + locally-disabled, +# "E" Error for important programming issues (likely bugs) + access-member-before-definition, + no-member, + no-method-argument, + no-self-argument, + not-an-iterable, +# "W" Warnings for stylistic problems or minor programming issues + abstract-method, + abstract-class-instantiated, + arguments-differ, + attribute-defined-outside-init, + bad-builtin, + bad-indentation, + broad-except, + dangerous-default-value, + deprecated-lambda, + expression-not-assigned, + fixme, + global-statement, + literal-comparison, + no-init, + non-parent-init-called, + not-callable, + protected-access, + redefined-builtin, + redefined-outer-name, + signature-differs, + star-args, + super-init-not-called, + super-on-old-class, + unpacking-non-sequence, + unused-argument, + unused-import, + unused-variable, + unsubscriptable-object, + useless-super-delegation, +# TODO(dougwig) - disable nonstandard-exception while we have neutron_lib shims + nonstandard-exception, +# "C" Coding convention violations + bad-continuation, + consider-iterating-dictionary, + consider-using-enumerate, + invalid-name, + len-as-condition, + misplaced-comparison-constant, + missing-docstring, + singleton-comparison, + superfluous-parens, + ungrouped-imports, + wrong-import-order, + wrong-import-position, +# "R" Refactor recommendations + abstract-class-little-used, + abstract-class-not-used, + consider-merging-isinstance, + consider-using-ternary, + duplicate-code, + interface-not-implemented, + no-else-return, + no-self-use, + redefined-argument-from-local, + simplifiable-if-statement, + too-few-public-methods, + too-many-ancestors, + too-many-arguments, + too-many-boolean-expressions, + too-many-branches, + too-many-function-args, + too-many-instance-attributes, + too-many-lines, + too-many-locals, + too-many-nested-blocks, + too-many-public-methods, + too-many-return-statements, + too-many-statements, + cyclic-import, + no-name-in-module, + bad-super-call + +[BASIC] +# Variable names can be 1 to 31 characters long, with lowercase and underscores +variable-rgx=[a-z_][a-z0-9_]{0,30}$ + +# Argument names can be 2 to 31 characters long, with lowercase and underscores +argument-rgx=[a-z_][a-z0-9_]{1,30}$ + +# Method names should be at least 3 characters long +# and be lowecased with underscores +method-rgx=([a-z_][a-z0-9_]{2,}|setUp|tearDown)$ + +# Module names matching neutron-* are ok (files in bin/) +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(neutron-[a-z0-9_-]+))$ + +# Don't require docstrings on tests. +no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$ + +[FORMAT] +# Maximum number of characters on a single line. +max-line-length=79 + +[VARIABLES] +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +# _ is used by our localization +additional-builtins=_ + +[CLASSES] +# List of interface methods to ignore, separated by a comma. +ignore-iface-methods= + +[IMPORTS] +# Deprecated modules which should not be used, separated by a comma +deprecated-modules= +# should use openstack.common.jsonutils + json + +[TYPECHECK] +# List of module names for which member attributes should not be checked +ignored-modules=six.moves,_MovedItems + +[REPORTS] +# Tells whether to display a full report or only the messages +reports=no diff --git a/.stestr.conf b/.stestr.conf index c001baf..fc68d82 100644 --- a/.stestr.conf +++ b/.stestr.conf @@ -1,3 +1,3 @@ [DEFAULT] -test_path=${OS_TEST_PATH:-./neutron_classifier/tests/unit} +test_path=./neutron_classifier/tests/unit top_dir=./ diff --git a/.zuul.yaml b/.zuul.yaml index f8dad8d..cbfb64f 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,15 +1,29 @@ - project: + templates: + - build-openstack-docs-pti + - check-requirements + - openstack-python-jobs + - openstack-python3-train-jobs check: jobs: + - neutron-classifier-tox-lower-constraints - neutron-classifier-functional-dsvm: required-projects: - openstack/neutron gate: + queue: neutron-classifier jobs: + - neutron-classifier-tox-lower-constraints - neutron-classifier-functional-dsvm: required-projects: - openstack/neutron +- job: + name: neutron-classifier-tox-lower-constraints + parent: openstack-tox-lower-constraints + required-projects: + - openstack/neutron + - job: name: neutron-classifier-functional-dsvm parent: legacy-dsvm-base @@ -18,10 +32,10 @@ timeout: 7800 required-projects: - openstack/devstack-gate - - opendev.org/openstack/keystone - - opendev.org/openstack/neutron + - openstack/keystone + - openstack/neutron roles: - - zuul: openstack-infra/devstack + - zuul: openstack/devstack-gate vars: devstack_localrc: DATABASE_PASSWORD: secretdatabase @@ -64,4 +78,4 @@ tempest: false osc_environment: PYTHONUNBUFFERED: 'true' - OS_CLOUD: devstack-admin \ No newline at end of file + OS_CLOUD: devstack-admin diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 0000000..3b6c4ab --- /dev/null +++ b/bindep.txt @@ -0,0 +1,31 @@ +# This file contains runtime (non-python) dependencies +# More info at: http://docs.openstack.org/infra/bindep/readme.html + +# tools/misc-sanity-checks.sh validates .po[t] files +gettext [test] + +# cffi (required by oslo.privsep) and PyNaCL (required by paramiko) +libffi-dev [platform:dpkg] +libffi-devel [platform:rpm] + +# MySQL and PostgreSQL databases since some jobs are set up in +# OpenStack infra that need these like +# periodic-neutron-py27-with-oslo-master and +# periodic-neutron-py35-with-neutron-lib-master. +haproxy +libmysqlclient-dev [platform:dpkg test] +mysql [platform:rpm test] +mysql-client [platform:dpkg test] +mysql-devel [platform:rpm test] +mysql-server [test] +postgresql [test] +postgresql-client [platform:dpkg test] +postgresql-devel [platform:rpm test] +postgresql-server [platform:rpm test] +postgresql-server-dev-all [platform:dpkg] + +# Neutron's test-requirements requires tempest which requires paramiko +# which requires cryptography which requires ssl. +libssl-dev [platform:dpkg] +openssl-devel [platform:rpm !platform:suse] +libopenssl-devel [platform:suse !platform:rpm] diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..86283a5 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,13 @@ +# 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. +sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD +oslosphinx>=4.7.0 # Apache-2.0 +openstackdocstheme>=1.18.1 # Apache-2.0 +oslotest>=3.2.0 # Apache-2.0 +reno>=2.5.0 # Apache-2.0 + +fixtures>=3.0.0 # Apache-2.0/BSD +testresources>=2.0.0 # Apache-2.0/BSD +testscenarios>=0.4 # Apache-2.0/BSD diff --git a/doc/source/conf.py b/doc/source/conf.py index 5b9de51..cbebffd 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # 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 @@ -12,60 +11,232 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import sys +# Build configuration file that is execfile()'d with the current directory +# set to it's containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. -sys.path.insert(0, os.path.abspath('../..')) -# -- General configuration ---------------------------------------------------- +import os +import subprocess +import sys +import warnings + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +ROOT_DIR = os.path.abspath(os.path.join(BASE_DIR, "..", "..")) +sys.path.insert(0, ROOT_DIR) + +# -- 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' -] +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.coverage', + 'sphinx.ext.ifconfig', + 'sphinx.ext.graphviz', + 'sphinx.ext.todo', + 'openstackdocstheme',] -# 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 +todo_include_todos = True + +# 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. +# The encoding of source files. +#source_encoding = 'utf-8' + +# The master doctree document. master_doc = 'index' # General information about the project. -project = u'neutron-classifier' -copyright = u'2013, OpenStack Foundation' +project = u'Neutron Library' +copyright = u'2015-present, OpenStack Foundation.' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# Version info +from neutron_classifier.version import version_info as neutron_class_version +release = neutron_class_version.release_string() +# The short X.Y version. +version = neutron_class_version.version_string() + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +# unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = [] + +# The reST default role (for this markup: `text`) to use for all documents. +#default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True +#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 +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +show_authors = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' -# -- Options for HTML output -------------------------------------------------- +# A list of ignored prefixes for module index sorting. +modindex_common_prefix = ['neutron_lib.'] + +# -- Options for man page output -------------------------------------------- + +# Grouping the document tree for man pages. +# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' + +# man_pages = [ +# ('man/neutron-lib', 'neutron-lib', u'Neutron Library', +# [u'OpenStack'], 1) +# ] + + +# -- 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'] +html_theme = 'openstackdocs' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = ['_theme'] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' +html_last_updated_fmt = '%Y-%m-%d %H:%M' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' # Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project +#htmlhelp_basename = 'neutronlibdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' # 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, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), +# (source start file, target name, title, author, +# documentclass [howto/manual]). +# latex_documents = [ +# ('index', 'NeutronLib.tex', u'Neutron Library Documentation', +# u'Neutron development team', 'manual'), +# ] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True + +# -- Options for openstackdocstheme ------------------------------------------- +repository_name = 'x/neutron-classifier' +bug_project = 'neutron-classifier' +bug_tag = 'doc' + +linkcheck_anchors_ignore = [ + # skip gerrit anchors + '\/q\/.*', + 'q\,.*', + '\/c\/.*' ] diff --git a/lower-constraints.txt b/lower-constraints.txt new file mode 100644 index 0000000..c101170 --- /dev/null +++ b/lower-constraints.txt @@ -0,0 +1,21 @@ +bandit==1.1.0 +coverage==4.0 +fixtures==3.0.0 +flake8-import-order==0.12 +flake8==2.6.2 +hacking==1.1.0 +keystoneauth1==3.14.0 +mock==2.0.0 +neutron-lib==1.28.0 +oslo.utils==3.40.2 +oslotest==3.2.0 +pbr==4.0.0 +python-neutronclient==6.7.0 +python-openstackclient==3.16.0 +psycopg2==2.7 +PyMySQL==0.7.6 +pylint==1.7.1 +SQLAlchemy==1.2.0 +sphinx==1.6.5 +stestr==1.0.0 +testtools==2.2.0 diff --git a/neutron_classifier/common/resources.py b/neutron_classifier/common/resources.py index c49af65..ecf9d58 100644 --- a/neutron_classifier/common/resources.py +++ b/neutron_classifier/common/resources.py @@ -21,6 +21,7 @@ def validate_string(String): String = '' return String + CLASSIFICATION_GROUP_RESOURCE_MAP = { 'id': { 'allow_post': False, 'allow_put': False, diff --git a/neutron_classifier/extensions/classification.py b/neutron_classifier/extensions/classification.py index 071df1e..7580f8c 100644 --- a/neutron_classifier/extensions/classification.py +++ b/neutron_classifier/extensions/classification.py @@ -40,6 +40,7 @@ def validate_string(String): String = '' return String + RESOURCE_ATTRIBUTE_MAP = { 'classification_type': classifier_resources.CLASSIFICATION_TYPE_RESOURCE_MAP, diff --git a/neutron_classifier/version.py b/neutron_classifier/version.py new file mode 100644 index 0000000..a08ab70 --- /dev/null +++ b/neutron_classifier/version.py @@ -0,0 +1,17 @@ +# Copyright 2011 OpenStack Foundation +# +# 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('neutron-classifier') diff --git a/requirements.txt b/requirements.txt index ffc3cf4..bd5e623 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,17 @@ -pbr>=2.0.0,!=2.1.0 # Apache-2.0 -Babel>=2.3.4,!=2.4.0 # BSD -keystoneauth1>=3.6.2 # Apache-2.0 +pbr>=4.0.0 # Apache-2.0 +keystoneauth1>=3.14.0 # Apache-2.0 python-neutronclient>=6.7.0 # Apache-2.0 python-openstackclient>=3.16.0 # Apache-2.0 -SQLAlchemy>=1.0.10,!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8 # MIT -neutron-lib>=1.18.0 # Apache-2.0 -neutron>=14.0.0 # Apache-2.0 -oslo.utils>=3.33.0 # Apache-2.0 +SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.2.0 # MIT +neutron-lib>=1.28.0 # Apache-2.0 +oslo.utils>=3.40.2 # Apache-2. + +# These repos are installed from git in OpenStack CI if the job +# configures them as required-projects: +neutron>=14.0.0.0rc1 # Apache-2.0 + +# The comment below indicates this project repo is current with neutron-lib +# and should receive neutron-lib consumption patches as they are released +# in neutron-lib. It also implies the project will stay current with TC +# and infra initiatives ensuring consumption patches can land. +# neutron-lib-current diff --git a/setup.cfg b/setup.cfg index b9b5d7c..5d2a2c7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ classifier = Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 [files] packages = diff --git a/setup.py b/setup.py index 056c16c..566d844 100644 --- a/setup.py +++ b/setup.py @@ -25,5 +25,5 @@ except ImportError: pass setuptools.setup( - setup_requires=['pbr'], + setup_requires=['pbr>=2.0.0'], pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index 2d781e3..aa45eff 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,21 +1,16 @@ -#The order of packages is significant, because pip processes them in the order +# 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>=1.1.0,<1.2.0 # Apache-2.0 - +hacking>=1.1.0 # Apache-2.0 +bandit!=1.6.0,>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 -python-subunit>=1.0.0 # Apache-2.0/BSD -sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD -sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD -openstackdocstheme>=1.18.1 # Apache-2.0 -oslosphinx>=4.7.0 # Apache-2.0 -WebOb>=1.7.1 # MIT +fixtures>=3.0.0 # Apache-2.0/BSD +flake8>=2.6.0 +flake8-import-order==0.12 # LGPLv3 +mock>=2.0.0 # BSD +psycopg2>=2.7 # LGPL/ZPL +PyMySQL>=0.7.6 # MIT License oslotest>=3.2.0 # Apache-2.0 -os-client-config>=1.28.0 # Apache-2.0 -stestr>=2.0.0 # Apache-2.0 -testresources>=2.0.0 # Apache-2.0/BSD -testscenarios>=0.4 # Apache-2.0/BSD +stestr>=1.0.0 # Apache-2.0 testtools>=2.2.0 # MIT -reno>=2.5.0 # Apache-2.0 -tempest>=17.1.0 # Apache-2.0 +pylint==1.7.6 # GPLv2 diff --git a/tox.ini b/tox.ini index 8c1be7a..b00722e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,40 +1,58 @@ [tox] -minversion = 1.6 -envlist = py36,py35,py27,pep8 +envlist = py36,py27,pep8,docs +minversion = 2.0 skipsdist = True [testenv] +setenv = VIRTUAL_ENV={envdir} + PYTHONWARNINGS=default::DeprecationWarning +passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY usedevelop = True -install_command = pip install {opts} {packages} -setenv = - VIRTUAL_ENV={envdir} - OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true} - OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true} - OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true} - PYTHONWARNINGS=default::DeprecationWarning -deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} - -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt whitelist_externals = sh - find stestr commands = - find . -type f -name "*.py[c|o]" -delete - find . -type d -name "__pycache__" -delete - stestr run {posargs} + stestr run {posargs} + stestr slowest + +[testenv:releasenotes] +basepython = python3 +deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -r{toxinidir}/doc/requirements.txt +commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + +[testenv:bandit] +# B104: Possible binding to all interfaces +# B303: Blacklist use of insecure MD2, MD4, MD5, or SHA1 hash functions +# B311: Standard pseudo-random generators are not suitable for security/cryptographic purpose +deps = -r{toxinidir}/test-requirements.txt +commands = bandit -r neutron_classifier -x tests -n5 -s B104,B303,B311 [testenv:pep8] basepython = python3 commands = - flake8 + flake8 + {[testenv:bandit]commands} [testenv:dsvm] basepython = python3 setenv = OS_FAIL_ON_MISSING_DEPS=1 OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs} +[testenv:venv] +basepython = python3 +commands = {posargs} + +[testenv:dev] +# run locally (not in the gate) using editable mode +# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs +# note that order is important to ensure dependencies don't override +commands = + pip install -q -e "git+https://opendev.org/openstack/neutron#egg=neutron" + [testenv:functional] basepython = python3 setenv = {[testenv]setenv} @@ -69,10 +87,6 @@ deps = commands = stestr run {posargs} -[testenv:venv] -basepython = python3 -commands = {posargs} - [testenv:cover] basepython = python3 setenv = @@ -82,14 +96,53 @@ commands = [testenv:docs] basepython = python3 -commands = python setup.py build_sphinx +deps = + -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -r{toxinidir}/requirements.txt + -r{toxinidir}/doc/requirements.txt +commands = sphinx-build -W -b html doc/source doc/build/html [testenv:debug] basepython = python3 commands = oslo_debug_helper {posargs} [flake8] +# H106: Don't put vim configuration in source files +# H203: Use assertIs(Not)None to check for None +# H204: Use assert(Not)Equal to check for equality +# H205: Use assert(Greater|Less)(Equal) for comparison +# H904: Delay string interpolations at logging calls +enable-extensions=H106,H203,H204,H205,H904 show-source = True -#ignore = -builtins = _ -exclude = ./.*,build,dist +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools +import-order-style = pep8 + +[hacking] +import_exceptions = vmware_nsx._i18n, +local-check-factory = neutron_lib.hacking.checks.factory + +[testenv:lower-constraints] +basepython = python3 +deps = + -c{toxinidir}/lower-constraints.txt + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/doc/requirements.txt + -r{toxinidir}/requirements.txt + +[testenv:py27-dev] +basepython = python2.7 +commands = + {[testenv:dev]commands} + pip freeze + stestr run {posargs} +whitelist_externals = + stestr + +[testenv:py3-dev] +basepython = python3 +commands = + {[testenv:dev]commands} + pip freeze + stestr run {posargs} +whitelist_externals = + stestr