Skip to content

Commit

Permalink
Tests: Add test case for settings import cycle (#2098)
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr authored May 1, 2024
1 parent 38285f1 commit a10f8aa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/typecheck/conf/test_settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- case: test_setting_circular_import
main: |
from myapp import lib
custom_settings: |
from myapp.lib import function_returning_int
IMMEDIATE_VALUE = 123
CIRCULAR_WITHOUT_HINT = function_returning_int()
CIRCULAR_WITH_HINT: int = function_returning_int()
files:
- path: myapp/__init__.py
- path: myapp/lib.py
content: |
from django.conf import settings
def test() -> None:
reveal_type(settings.IMMEDIATE_VALUE) # N: Revealed type is "builtins.int"
reveal_type(settings.CIRCULAR_WITHOUT_HINT) # E: Import cycle from Django settings module prevents type inference for 'CIRCULAR_WITHOUT_HINT' [misc] # N: Revealed type is "Any"
reveal_type(settings.CIRCULAR_WITH_HINT) # N: Revealed type is "builtins.int"
def function_returning_int() -> int:
return 42

0 comments on commit a10f8aa

Please sign in to comment.