mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-12 23:16:31 +08:00
Adds django@4.0 support (#786)
* Adds django@4.0 support * Fixes CI * Fixes CI * Ignore new error for django4.0 * Fixes
This commit is contained in:
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@@ -52,8 +52,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ['3.6', '3.7', '3.8', '3.9']
|
python-version: ['3.8', '3.9', '3.10']
|
||||||
django-version: ['2.2', '3.0']
|
django-version: ['3.2', '4.0']
|
||||||
|
include:
|
||||||
|
- python-version: '3.7'
|
||||||
|
django-version: '2.2'
|
||||||
|
- python-version: '3.6'
|
||||||
|
django-version: '2.2'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Setup system dependencies
|
- name: Setup system dependencies
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ServerHandler(simple_server.ServerHandler):
|
|||||||
|
|
||||||
class WSGIRequestHandler(simple_server.WSGIRequestHandler):
|
class WSGIRequestHandler(simple_server.WSGIRequestHandler):
|
||||||
close_connection: bool
|
close_connection: bool
|
||||||
connection: WSGIRequest
|
connection: WSGIRequest # type: ignore[assignment]
|
||||||
request: WSGIRequest
|
request: WSGIRequest
|
||||||
rfile: BytesIO
|
rfile: BytesIO
|
||||||
wfile: BytesIO
|
wfile: BytesIO
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ IGNORED_ERRORS = {
|
|||||||
"Unsupported dynamic base class",
|
"Unsupported dynamic base class",
|
||||||
'error: "HttpResponse" has no attribute "streaming_content"',
|
'error: "HttpResponse" has no attribute "streaming_content"',
|
||||||
'error: "HttpResponse" has no attribute "context_data"',
|
'error: "HttpResponse" has no attribute "context_data"',
|
||||||
|
'Duplicate module named "apps"',
|
||||||
],
|
],
|
||||||
"admin_checks": ['Argument 1 to "append" of "list" has incompatible type "str"; expected "CheckMessage"'],
|
"admin_checks": ['Argument 1 to "append" of "list" has incompatible type "str"; expected "CheckMessage"'],
|
||||||
"admin_default_site": [
|
"admin_default_site": [
|
||||||
@@ -514,7 +515,7 @@ IGNORED_ERRORS = {
|
|||||||
|
|
||||||
|
|
||||||
def check_if_custom_ignores_are_covered_by_common() -> None:
|
def check_if_custom_ignores_are_covered_by_common() -> None:
|
||||||
from scripts.typecheck_tests import is_pattern_fits
|
from scripts.typecheck_tests import does_pattern_fit
|
||||||
|
|
||||||
common_ignore_patterns = IGNORED_ERRORS["__common__"]
|
common_ignore_patterns = IGNORED_ERRORS["__common__"]
|
||||||
for module_name, patterns in IGNORED_ERRORS.items():
|
for module_name, patterns in IGNORED_ERRORS.items():
|
||||||
@@ -522,7 +523,7 @@ def check_if_custom_ignores_are_covered_by_common() -> None:
|
|||||||
continue
|
continue
|
||||||
for pattern in patterns:
|
for pattern in patterns:
|
||||||
for common_pattern in common_ignore_patterns:
|
for common_pattern in common_ignore_patterns:
|
||||||
if isinstance(pattern, str) and is_pattern_fits(common_pattern, pattern):
|
if isinstance(pattern, str) and does_pattern_fit(common_pattern, pattern):
|
||||||
print(f'pattern "{module_name}: {pattern!r}" is covered by pattern {common_pattern!r}')
|
print(f'pattern "{module_name}: {pattern!r}" is covered by pattern {common_pattern!r}')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ from scripts.enabled_test_modules import EXTERNAL_MODULES, IGNORED_ERRORS, IGNOR
|
|||||||
from scripts.git_helpers import checkout_django_branch
|
from scripts.git_helpers import checkout_django_branch
|
||||||
from scripts.paths import DJANGO_SOURCE_DIRECTORY, PROJECT_DIRECTORY
|
from scripts.paths import DJANGO_SOURCE_DIRECTORY, PROJECT_DIRECTORY
|
||||||
|
|
||||||
DJANGO_COMMIT_REFS: Dict[str, str] = {
|
DJANGO_COMMIT_REFS = {
|
||||||
"2.2": "8093aaa8ff9dd7386a069c6eb49fcc1c5980c033",
|
"2.2": "8093aaa8ff9dd7386a069c6eb49fcc1c5980c033",
|
||||||
"3.0": "44da7abda848f05caaed74f6a749038c87dedfda",
|
"3.2": "0153a63a674937e4a56d9d5e4ca2d629b011fbde",
|
||||||
|
"4.0": "67d0c4644acfd7707be4a31e8976f865509b09ac",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ def get_unused_ignores(ignored_message_freq: Dict[str, Dict[Union[str, Pattern],
|
|||||||
return unused_ignores
|
return unused_ignores
|
||||||
|
|
||||||
|
|
||||||
def is_pattern_fits(pattern: Union[Pattern, str], line: str):
|
def does_pattern_fit(pattern: Union[Pattern, str], line: str):
|
||||||
if isinstance(pattern, Pattern):
|
if isinstance(pattern, Pattern):
|
||||||
if pattern.search(line):
|
if pattern.search(line):
|
||||||
return True
|
return True
|
||||||
@@ -46,12 +47,12 @@ def is_ignored(line: str, test_folder_name: str, *, ignored_message_freqs: Dict[
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
for pattern in IGNORED_ERRORS.get(test_folder_name, []):
|
for pattern in IGNORED_ERRORS.get(test_folder_name, []):
|
||||||
if is_pattern_fits(pattern, line):
|
if does_pattern_fit(pattern, line):
|
||||||
ignored_message_freqs[test_folder_name][pattern] += 1
|
ignored_message_freqs[test_folder_name][pattern] += 1
|
||||||
return True
|
return True
|
||||||
|
|
||||||
for pattern in IGNORED_ERRORS["__common__"]:
|
for pattern in IGNORED_ERRORS["__common__"]:
|
||||||
if is_pattern_fits(pattern, line):
|
if does_pattern_fit(pattern, line):
|
||||||
ignored_message_freqs["__common__"][pattern] += 1
|
ignored_message_freqs["__common__"][pattern] += 1
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user