Skip to content

Update django-stubs, mypy, pytest-mypy-plugins & fix tests #279

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

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ wheel
gitpython==3.1.27
pre-commit==2.20.0
pytest==7.1.2
pytest-mypy-plugins==1.9.3
pytest-mypy-plugins==1.10.1
djangorestframework==3.13.1
types-pytz==2022.1.2
django-stubs==1.12.0
django-stubs-ext==0.5.0
django-stubs==1.13.0
django-stubs-ext==0.7.0
-e .[compatible-mypy,coreapi,markdown]
4 changes: 2 additions & 2 deletions scripts/drf_tests_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SECRET_KEY = "1"
SITE_ID = 1

INSTALLED_APPS = [
INSTALLED_APPS = (
"django.contrib.contenttypes",
"django.contrib.sites",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INSTALLED_APPS must be tuple for typecheck_tests, because DRF test suite does:

settings.INSTALLED_APPS += ('guardian',)

Better than ignoring IMO.

"django.contrib.sessions",
Expand All @@ -11,4 +11,4 @@
"django.contrib.auth",
"rest_framework",
"rest_framework.authtoken",
]
)
1 change: 1 addition & 0 deletions scripts/typecheck_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
'Incompatible types in assignment (expression has type "AsView[GenericView]", variable has type "AsView[Callable[[HttpRequest], Any]]")', # noqa: E501
'Argument "patterns" to "SchemaGenerator" has incompatible type "List[object]"',
'Argument 1 to "field_to_schema" has incompatible type "object"; expected "Field[Any, Any, Any, Any]"',
'Argument "help_text" to "CharField" has incompatible type "_StrPromise"',
Copy link
Contributor Author

@intgr intgr Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we can make help_text: StrOrPromise in a follow-up PR.

],
"browsable_api": [
'(expression has type "List[Dict[str, Dict[str, int]]]", base class "GenericAPIView" defined the type as "Union[QuerySet[_MT?], Manager[_MT?], None]")', # noqa: E501
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ def find_stub_files(name):
readme = f.read()

dependencies = [
"mypy>=0.950",
"django-stubs>=1.11.0",
"mypy>=0.980",
"django-stubs>=1.13.0",
"typing-extensions>=3.10.0",
"requests>=2.0.0",
"types-requests>=0.1.12",
"types-PyYAML>=5.4.3",
]

extras_require = {
"compatible-mypy": ["mypy>=0.950,<0.970"],
"compatible-mypy": ["mypy>=0.980,<0.990"],
"coreapi": ["coreapi>=2.0.0"],
"markdown": ["types-Markdown>=0.1.5"],
}
Expand Down