Skip to content

configuration with wildcards cannot match modules? #5449

Closed
@asottile

Description

@asottile

My goal: enforce disallow_untyped_defs in my application but not in my tests.

Here's my setup:

mypy.ini
app
├── __init__.py
└── app.py
tests
├── __init__.py
├── subdir
│   └── test_two.py
└── test_one.py

The important contents:

# tests/test_one.py
def test_one():
    pass
# tests/subdir/test_two.py
def test_two():
    pass

And either of these two mypy.ini files:

[mypy]
disallow_untyped_defs = true

[mypy-tests.*]
disallow_untyped_defs = false
[mypy]
disallow_untyped_defs = true

[mypy-tests.*]
disallow_untyped_defs = false

[mypy-tests.subdir.*]
disallow_untyped_defs = false

I expect this command to produce no errors:

$ mypy app/__init__.py app/app.py tests/__init__.py tests/subdir/test_two.py tests/test_one.py
tests/subdir/test_two.py:1: error: Function is missing a type annotation

version info

$ mypy --version
mypy 0.620

CC @ethanhs since we chatted about this in IRC/slack

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions