# -----------------------------------------------------------------------------
# pytest
# -----------------------------------------------------------------------------

[tool:pytest]
testpaths = tests
addopts = --verbose
junit_family = xunit2

[aliases]
test = pytest

# -----------------------------------------------------------------------------
# coverage
# -----------------------------------------------------------------------------

[coverage:report]
# Coverage couldn't detect backward functions because they are called by C++.
# Append "# pragma: no cover" to the definition lines to ignore them.
# https://www.janfreyberg.com/blog/2019-04-01-testing-pytorch-functions/
exclude_lines = pragma: no cover

# -----------------------------------------------------------------------------
# flake8
# -----------------------------------------------------------------------------

[flake8]
select = B,C,E,F,P,T4,W,B9
max-line-length = 120
# C408 ignored because we like the dict keyword argument syntax
# E501 is not flexible enough, we're using B950 instead
ignore =
    E203,E305,E402,E501,E721,E741,F403,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303,
per-file-ignores = __init__.py: F401
exclude = build,*.pyi,.git

# -----------------------------------------------------------------------------
# mypy
# -----------------------------------------------------------------------------

# Docs for mypy config: https://mypy.readthedocs.io/en/latest/config_file.html
[mypy]
mypy_path = ./stubs/
follow_imports = normal
plugins = numpy.typing.mypy_plugin

# This project must be strictly typed.
[mypy-fairscale.*]
check_untyped_defs = true
disallow_untyped_defs = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_incomplete_defs = true
warn_unused_ignores = true

[mypy-fairscale.experimental.nn.distributed_pipeline.trace]
ignore_errors = True

[mypy-fairscale.experimental.nn.auto_shard]
ignore_errors = True

[mypy-benchmarks.*]
ignore_errors = True

# Ignore missing imports from untyped third-party libraries.
[mypy-torch.*,torchvision.*,setuptools.*,pytest.*]
ignore_missing_imports = true
