Skip to content

Commit

Permalink
Fix mypy tests (DataDog#10134)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianVeaux authored Sep 15, 2021
1 parent e28eb39 commit aad7c43
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 9 deletions.
2 changes: 2 additions & 0 deletions aerospike/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ dd_check_types = true
dd_mypy_args =
--py2
--follow-imports silent
--install-types
--non-interactive
datadog_checks/aerospike
usedevelop = true
platform = linux|darwin|win32
Expand Down
9 changes: 8 additions & 1 deletion azure_iot_edge/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ envdir =
py38: {toxworkdir}/py38
dd_check_style = true
dd_check_types = true
dd_mypy_args = --check-untyped-defs --py2 datadog_checks/ tests/
dd_mypy_args =
--check-untyped-defs
--py2
--install-types
--non-interactive
--follow-imports skip
datadog_checks/
tests/
description =
py{27,38}: e2e ready if IOT_EDGE_CONNSTR
usedevelop = true
Expand Down
9 changes: 8 additions & 1 deletion cloud_foundry_api/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ envlist =
[testenv]
dd_check_style = true
dd_check_types = true
dd_mypy_args = --py2 datadog_checks/ tests/
dd_mypy_args =
--py2
--install-types
--non-interactive
datadog_checks/
tests/
dd_mypy_deps =
types-mock==0.1.5
usedevelop = true
platform = linux|darwin|win32
deps =
Expand Down
2 changes: 2 additions & 0 deletions datadog_checks_base/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ dd_mypy_args =
--py2
--check-untyped-defs
--follow-imports silent
--install-types
--non-interactive
datadog_checks/base/checks/base.py
datadog_checks/base/checks/win/wmi/__init__.py
datadog_checks/base/checks/win/winpdh_base.py
Expand Down
5 changes: 5 additions & 0 deletions datadog_checks_dev/datadog_checks/dev/plugin/tox.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
STYLE_FLAG = 'dd_check_style'
TYPES_FLAG = 'dd_check_types'
MYPY_ARGS_OPTION = 'dd_mypy_args'
MYPY_ADDITIONAL_DEPS = 'dd_mypy_deps'
E2E_READY_CONDITION = 'e2e ready if'
FIX_DEFAULT_ENVDIR_FLAG = 'ensure_default_envdir'

Expand Down Expand Up @@ -142,11 +143,15 @@ def add_style_checker(config, sections, make_envconfig, reader):
# Each integration should explicitly specify its options and which files it'd like to type check, which is
# why we're defaulting to 'no arguments' by default.
mypy_args = sections['testenv'].get(MYPY_ARGS_OPTION, '')
mypy_deps = sections['testenv'].get(MYPY_ADDITIONAL_DEPS, "").splitlines()

# Allow using multiple lines for enhanced readability in case of large amount of options/files to check.
mypy_args = mypy_args.replace('\n', ' ')

dependencies.append(MYPY_DEP)
for mypy_dep in mypy_deps:
dependencies.append(mypy_dep)

commands.append('mypy --config-file=../mypy.ini {}'.format(mypy_args))

sections[section] = {
Expand Down
9 changes: 8 additions & 1 deletion glusterfs/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ envdir =
py38: {toxworkdir}/py38
dd_check_style = true
dd_check_types = true
dd_mypy_args = --py2 datadog_checks/ tests/ --exclude '.*/config_models/.*\.py$'
dd_mypy_args =
--py2
datadog_checks/
tests/
--exclude
'.*/config_models/.*\.py$'
dd_mypy_deps =
types-mock==0.1.5
usedevelop = true
platform = linux|darwin|win32
deps =
Expand Down
11 changes: 10 additions & 1 deletion ibm_mq/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ description=
py{27,38}: e2e ready
dd_check_style = true
dd_check_types = true
dd_mypy_args = --py2 datadog_checks/ tests/ --exclude '.*/config_models/.*\.py$'
dd_mypy_args =
--py2
--install-types
--non-interactive
datadog_checks/
tests/
--exclude
'.*/config_models/.*\.py$'
dd_mypy_deps =
types-mock==0.1.5
platform = linux|darwin|win32
deps =
-e../datadog_checks_base[deps]
Expand Down
10 changes: 9 additions & 1 deletion marklogic/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ envlist =

[testenv]
dd_check_types = true
dd_mypy_args = --disallow-untyped-defs --py2 datadog_checks/ tests/
dd_mypy_args =
--disallow-untyped-defs
--py2
--install-types
--non-interactive
datadog_checks/
tests/
dd_mypy_deps =
types-mock==0.1.5
description =
py{27,38}: e2e ready
dd_check_style = true
Expand Down
4 changes: 4 additions & 0 deletions mysql/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ dd_mypy_args =
--py2
--check-untyped-defs
--follow-imports silent
--install-types
--non-interactive
datadog_checks/mysql/statements.py
dd_mypy_deps =
types-cachetools==0.1.10
usedevelop = true
platform = linux|darwin|win32
passenv =
Expand Down
11 changes: 10 additions & 1 deletion postgres/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ description =
py{27,38}: e2e ready
dd_check_style = true
dd_check_types = true
dd_mypy_args = --py2 datadog_checks/ tests/ --exclude '.*/config_models/.*\.py$'
dd_mypy_args =
--py2
--install-types
--non-interactive
datadog_checks/
tests/
--exclude '.*/config_models/.*\.py$'
dd_mypy_deps =
types-mock==0.1.5
types-cachetools==0.1.10
usedevelop = true
platform = linux|darwin|win32
passenv =
Expand Down
10 changes: 9 additions & 1 deletion rethinkdb/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ envdir =
py38: {toxworkdir}/py38
dd_check_style = true
dd_check_types = true
dd_mypy_args = --py2 --disallow-untyped-defs datadog_checks/ tests/
dd_mypy_args =
--py2
--disallow-untyped-defs
--install-types
--non-interactive
datadog_checks/
tests/
dd_mypy_deps =
types-mock==0.1.5
description =
py{27,38}: e2e ready
usedevelop = true
Expand Down
2 changes: 2 additions & 0 deletions snmp/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ dd_mypy_args =
--py2
--disallow-untyped-defs
--follow-imports silent
--install-types
--non-interactive
datadog_checks/snmp
usedevelop = true
platform = linux|darwin|win32
Expand Down
11 changes: 10 additions & 1 deletion snowflake/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ envdir =
py38: {toxworkdir}/py38
dd_check_style = true
dd_check_types = true
dd_mypy_args = --py2 datadog_checks/ tests/ --exclude '.*/config_models/.*\.py$'
dd_mypy_args =
--py2
--install-types
--non-interactive
datadog_checks/
tests/
--exclude
'.*/config_models/.*\.py$'
dd_mypy_deps =
types-mock==0.1.5
description =
py38: e2e ready
usedevelop = true
Expand Down
11 changes: 10 additions & 1 deletion voltdb/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ envdir =
py38: {toxworkdir}/py38
dd_check_style = true
dd_check_types = true
dd_mypy_args = datadog_checks/ tests/
dd_mypy_args =
--py2
--install-types
--non-interactive
datadog_checks/
tests/
--exclude
'.*/config_models/.*\.py$'
dd_mypy_deps =
types-mock==0.1.5
description =
py{27,38}: e2e ready
usedevelop = true
Expand Down
2 changes: 2 additions & 0 deletions vsphere/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ dd_mypy_args =
--py2
--disallow-untyped-defs
--follow-imports silent
--install-types
--non-interactive
datadog_checks/vsphere/api.py
datadog_checks/vsphere/api_rest.py
datadog_checks/vsphere/cache.py
Expand Down

0 comments on commit aad7c43

Please sign in to comment.