Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configuration with wildcards cannot match modules? #5449

Closed
asottile opened this issue Aug 10, 2018 · 2 comments
Closed

configuration with wildcards cannot match modules? #5449

asottile opened this issue Aug 10, 2018 · 2 comments

Comments

@asottile
Copy link
Contributor

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

@asottile
Copy link
Contributor Author

A workaround is to touch tests/subdir/__init__.py

though this should not be necessary due to PEP 420

@ethanhs
Copy link
Collaborator

ethanhs commented Aug 10, 2018

This is a duplicate of #1645. I'll bump priority to high over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants