blob: 237c9e598cec479d217a8053f7a5958dc26653ab [file] [log] [blame]
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
[tox]
envlist = py36,py37,py38,py39,py310
skipsdist = True
minversion = ${TOX_VERSION}
skip_missing_interpreters = True
skip_install = True
[testenv]
commands =
flake8 --count --show-source \
${CMAKE_SOURCE_DIR}/python \
${CMAKE_SOURCE_DIR}/docs \
${CMAKE_SOURCE_DIR}/tests \
${CMAKE_SOURCE_DIR}/tools \
${CMAKE_SOURCE_DIR}/tools/qdstat \
${CMAKE_SOURCE_DIR}/tools/qdmanage
# TODO(pylint#5648): crash while parsing system_test.py
pylint --jobs 2 --rcfile ${CMAKE_BINARY_DIR}/tests/tox.ini \
--ignore=system_test.py \
${CMAKE_SOURCE_DIR}/python \
${CMAKE_SOURCE_DIR}/docs \
${CMAKE_SOURCE_DIR}/tests \
${CMAKE_SOURCE_DIR}/tools \
${CMAKE_SOURCE_DIR}/tools/qdstat \
${CMAKE_SOURCE_DIR}/tools/qdmanage
mypy --config-file ${CMAKE_BINARY_DIR}/tests/tox.ini \
${CMAKE_SOURCE_DIR}/python \
${CMAKE_SOURCE_DIR}/docs \
${CMAKE_SOURCE_DIR}/tests \
${CMAKE_SOURCE_DIR}/tools \
${CMAKE_BINARY_DIR}/python/qpid_dispatch_site.py
# new checker versions sometimes add new checks; pin the versions to avoid unexpected
# surprises to folks just trying to get their job done (c.f. DISPATCH-1305, DISPATCH-1466, DISPATCH-1834)
deps =
# TODO(DISPATCH-2321) also install python-qpid-proton here
hacking==4.1.0
# hacking 4.1.0 requires flake8<3.9.0 and >=3.8.0
flake8==3.8.4
pylint==2.12.2
mypy==0.910
[testenv:py36]
basepython = python3.6
[testenv:py37]
basepython = python3.7
[testenv:py38]
basepython = python3.8
[testenv:py39]
basepython = python3.9
[testenv:py310]
basepython = python3.10
[flake8]
# TODO(DISPATCH-1974) decrease the limit
max-line-length = 464
# TODO(DISPATCH-1974) re-enable all these warnings
ignore =
# H238: old style class declaration, use new style (inherit from `object`)
H238,
# E704 multiple statements on one line (def)
E704,
# E241 multiple spaces after ','
E241,
# E203 whitespace before ':'
E203,
# H101: Use TODO(NAME)
H101,
# H202: assertRaises Exception too broad
H202,
# H401: docstring should not start with a space
H401,
# H403: multi line docstrings should end on a new line
H403,
# H404: multi line docstring should start without a leading new line
H404,
# H405: multi line docstring summary not separated with an empty line
H405,
# E265 block comment should start with '# '
E265,
# E266 too many leading '#' for block comment
E266,
# E221 multiple spaces before operator
E221,
# E222 multiple spaces after operator
E222,
# do not use bare 'except'
E722,
# H201: no 'except:' at least use 'except Exception:'
H201,
# H104: File contains nothing but comments
H104,
# H301: one import per line
H301,
# H306: imports not in alphabetical order
H306,
# F811 redefinition of unused 'Timeout' from line 29
F811,
# E712 comparison to True should be 'if cond is not True:' or 'if not cond:'
# E712 comparison to False should be 'if cond is False:' or 'if not cond:'
E712,
# E402 module level import not at top of file
E402,
# may be undefined, or defined from star imports: datetime
F405,
# ambiguous variable name 'l'
E741,
# local variable 'int_nodes' is assigned to but never used
F841,
# TODO(DISPATCH-1974) decide which of these two warnings we want disabled
# _transport.py:908:21: W503 line break before binary operator
# _transport.py:907:56: W504 line break after binary operator
W503,
W504,
[pytest]
# https://github.com/pytest-dev/pytest/blob/main/src/_pytest/junitxml.py
# do not filter test file names
python_files = *.py
# https://docs.pytest.org/en/6.2.x/logging.html#incompatible-changes-in-pytest-3-4
log_level = DEBUG
# pylint
[MESSAGE_CONTROL]
disable =
access-member-before-definition,
arguments-differ,
attribute-defined-outside-init,
bad-super-call,
bare-except,
broad-except,
consider-iterating-dictionary,
consider-using-dict-comprehension,
consider-using-dict-items,
consider-using-enumerate,
consider-using-f-string,
consider-using-with,
deprecated-module,
duplicate-code,
empty-docstring,
fatal,
fixme,
function-redefined,
global-statement,
import-error,
import-outside-toplevel,
inconsistent-return-statements,
invalid-name,
line-too-long,
method-hidden,
missing-docstring,
missing-function-docstring,
missing-module-docstring,
multiple-statements,
no-else-break,
no-else-raise,
no-else-return,
no-member,
no-name-in-module,
no-self-use,
parse-error,
protected-access,
raise-missing-from,
redefined-builtin,
redefined-outer-name,
redundant-unittest-assert,
singleton-comparison,
super-init-not-called,
super-with-arguments,
too-few-public-methods,
too-many-arguments,
too-many-branches,
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,
unnecessary-pass,
unspecified-encoding,
unsubscriptable-object,
unused-argument,
unused-variable,
use-dict-literal,
use-list-literal,
useless-else-on-loop,
useless-super-delegation,
wrong-import-position,
[mypy]
warn_redundant_casts = True
warn_unused_ignores = True
# mypy cannot handle overridden attributes
# https://github.com/python/mypy/issues/7505
allow_untyped_globals = True
# https://mypy.readthedocs.io/en/stable/error_codes.html#displaying-error-codes
show_error_codes = True
# this would print lots and lots of errors
# check_untyped_defs = True
# ignore missing stub files for dependencies
#[mypy-_ssl]
#ignore_missing_imports = True
[mypy-proton.*]
ignore_missing_imports = True
[mypy-cproton]
ignore_missing_imports = True
[mypy-qpidtoollibs]
ignore_missing_imports = True
[mypy-qpid_messaging]
ignore_missing_imports = True
[mypy-pyprof2calltree]
ignore_missing_imports = True
[mypy-quart.*]
ignore_missing_imports = True
[mypy-werkzeug.*]
ignore_missing_imports = True
[mypy-websockets]
ignore_missing_imports = True
[mypy-pytest]
ignore_missing_imports = True