diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 642b61042..4760fdcc3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,7 @@ repos: exclude: '.*\.(svg)$' - id: check-byte-order-marker - id: check-executables-have-shebangs + - id: check-json - id: check-merge-conflict - id: debug-statements - repo: https://github.com/PyCQA/bandit @@ -42,6 +43,16 @@ repos: - flake8-import-order~=0.18.2 - neutron exclude: '^(doc|releasenotes|tools)/.*$' + - repo: local + hooks: + - id: check-unit-test-structure + name: check unit test structure + language: script + require_serial: true + pass_filenames: false + entry: './tools/check_unit_test_structure.sh' + files: '^.*\.py$' + exclude: '^(doc|releasenotes|tools)/.*$' # TODO(slaweq): enable pylint check once all issues in the current code will # be solved # - id: pylint diff --git a/api-ref/source/v2/samples/networks/networks-provider-list-response.json b/api-ref/source/v2/samples/networks/networks-provider-list-response.json index f3a494f8c..2d9546812 100644 --- a/api-ref/source/v2/samples/networks/networks-provider-list-response.json +++ b/api-ref/source/v2/samples/networks/networks-provider-list-response.json @@ -51,7 +51,6 @@ "name": "net2", "port_security_enabled": true, "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e", - "qos_policy_id": null, "provider:network_type": "local", "provider:physical_network": null, "provider:segmentation_id": null, diff --git a/test-requirements.txt b/test-requirements.txt index ca5826aac..e72576c48 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,15 +1,6 @@ -hacking>=6.1.0,<6.2.0 # Apache-2.0 - -bandit>=1.1.0 # Apache-2.0 -coverage>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT fixtures>=3.0.0 # Apache-2.0/BSD -flake8-import-order>=0.18.0,<0.19.0 # LGPLv3 -pylint>=2.2.0 # GPLv2 -isort==4.3.21 # MIT -python-subunit>=1.0.0 # Apache-2.0/BSD +hacking>=6.1.0,<6.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 -testresources>=2.0.0 # Apache-2.0/BSD -testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT diff --git a/tools/check_samples.sh b/tools/check_samples.sh deleted file mode 100755 index e11446d3c..000000000 --- a/tools/check_samples.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# Copyright (C) 2017 Midokura SARL. -# 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. - -set -e - -DIR=api-ref/source/v2/samples -find $DIR -name "*.json" | while read f; do - if ! python -m json.tool $f > /dev/null; then - echo "$f had errors." - exit 1 - fi -done diff --git a/tox.ini b/tox.ini index 0d14ebc8a..6915ac800 100644 --- a/tox.ini +++ b/tox.ini @@ -20,34 +20,24 @@ allowlist_externals = bash commands = stestr run {posargs} -[testenv:mypy] -deps = {[testenv:pep8]deps} -commands = - mypy - [testenv:pep8] +description = + Run style checks. deps = {[testenv]deps} - mypy==1.14.1 + pre-commit~=4.2 # MIT + pylint~=3.0 # GPLv2 commands = - flake8 - bash {toxinidir}/tools/check_samples.sh - bash {toxinidir}/tools/check_unit_test_structure.sh - bash ./tools/coding-checks.sh --pylint '{posargs}' - {[testenv:bandit]commands} - {[testenv:mypy]commands} - -[testenv:releasenotes] -deps = - -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} - -r{toxinidir}/requirements.txt - -r{toxinidir}/doc/requirements.txt -commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + pre-commit run --all-files --show-diff-on-failure + pylint --rcfile=.pylintrc --output-format=colorized neutron_lib [testenv:venv] commands = {posargs} [testenv:cover] +deps = + {[testenv]deps} + coverage>=4.0 # Apache-2.0 setenv = {[testenv]setenv} PYTHON=coverage run --source neutron_lib --parallel-mode @@ -62,7 +52,8 @@ deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/doc/requirements.txt -commands = sphinx-build -W -b html doc/source doc/build/html +commands = + sphinx-build -W -b html doc/source doc/build/html [testenv:pdf-docs] deps = {[testenv:docs]deps} @@ -73,27 +64,24 @@ commands = make -C doc/build/pdf [testenv:api-ref] -allowlist_externals = rm -deps = - -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} - -r{toxinidir}/requirements.txt - -r{toxinidir}/doc/requirements.txt +deps = {[testenv:docs]deps} commands = - rm -rf api-ref/build - sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html + sphinx-build -W -b html api-ref/source api-ref/build/html [testenv:linkcheck] -deps = - -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} - -r{toxinidir}/requirements.txt - -r{toxinidir}/doc/requirements.txt allowlist_externals = rm +deps = {[testenv:docs]deps} commands = rm -rf api-ref/build - sphinx-build -W -b linkcheck api-ref/source api-ref/build/linkcheck rm -rf doc/build + sphinx-build -W -b linkcheck api-ref/source api-ref/build/linkcheck sphinx-build -W -b linkcheck doc/source doc/build/linkcheck +[testenv:releasenotes] +deps = {[testenv:docs]deps} +commands = + sphinx-build -W -b html releasenotes/source releasenotes/build/html + [testenv:debug] commands = oslo_debug_helper -t neutron_lib/tests/unit {posargs}