mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 12:14:28 +08:00
add config file support
This commit is contained in:
23
test-data/typecheck/config.test
Normal file
23
test-data/typecheck/config.test
Normal file
@@ -0,0 +1,23 @@
|
||||
[CASE missing_settings_ignored_flag]
|
||||
from django.conf import settings
|
||||
reveal_type(settings.NO_SUCH_SETTING) # E: Revealed type is 'Any'
|
||||
|
||||
[env MYPY_DJANGO_CONFIG=${MYPY_CWD}/mypy_django.ini]
|
||||
|
||||
[file mypy_django.ini]
|
||||
[[mypy_django_plugin]
|
||||
ignore_missing_settings = True
|
||||
[out]
|
||||
|
||||
[CASE django_settings_via_config_file]
|
||||
from django.conf import settings
|
||||
reveal_type(settings.MY_SETTING) # E: Revealed type is 'builtins.int'
|
||||
|
||||
[env MYPY_DJANGO_CONFIG=${MYPY_CWD}/mypy_django.ini]
|
||||
[file mypy_django.ini]
|
||||
[[mypy_django_plugin]
|
||||
django_settings = mysettings
|
||||
|
||||
[file mysettings.py]
|
||||
MY_SETTING: int = 1
|
||||
[out]
|
||||
Reference in New Issue
Block a user