-
-
Notifications
You must be signed in to change notification settings - Fork 458
/
Copy pathtest_config.yml
67 lines (64 loc) · 2.34 KB
/
test_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
- case: pyproject_toml_config
main: |
from myapp.models import MyModel
mymodel = MyModel(user_id=1)
reveal_type(mymodel.id) # N: Revealed type is "builtins.int"
reveal_type(mymodel.user) # N: Revealed type is "django.contrib.auth.models.User"
reveal_type(mymodel.objects) # N: Revealed type is "django.db.models.manager.Manager[myapp.models.MyModel]"
mypy_config: |
[mypy.plugins.django-stubs]
django_settings_module = mysettings
custom_settings: |
SECRET_KEY = '1'
INSTALLED_APPS = ('django.contrib.contenttypes', 'django.contrib.auth', 'myapp')
files:
- path: myapp/__init__.py
- path: myapp/models.py
content: |
from typing import TYPE_CHECKING
from django.db import models
class MyModel(models.Model):
user = models.ForeignKey('auth.User', on_delete=models.CASCADE)
if TYPE_CHECKING:
reveal_type(MyModel().user) # N: Revealed type is "django.contrib.auth.models.User"
- case: generate_pyproject_toml_and_settings_file_from_installed_apps_key
main: |
from myapp.models import MyModel
mymodel = MyModel(user_id=1)
reveal_type(mymodel.id) # N: Revealed type is "builtins.int"
installed_apps:
- django.contrib.auth
- myapp
files:
- path: myapp/__init__.py
- path: myapp/models.py
content: |
from django.db import models
class MyModel(models.Model):
user = models.ForeignKey('auth.User', on_delete=models.CASCADE)
- case: add_mypy_path_to_package_search
main: |
import extra_module
mypy_config: |
[mypy]
mypy_path = ./extras
[mypy.plugins.django-stubs]
django_settings_module = mysettings
files:
- path: extras/extra_module.py
content: |
def extra_fn() -> None:
pass
- case: add_mypypath_env_var_to_package_search
main: |
import extra_module
mypy_config: |
[mypy.plugins.django-stubs]
django_settings_module = mysettings
files:
- path: extras/extra_module.py
content: |
def extra_fn() -> None:
pass
env:
- MYPYPATH=./extras