mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 12:44:29 +08:00
typecheck django tests, allow failures
This commit is contained in:
12
.travis.yml
12
.travis.yml
@@ -7,19 +7,27 @@ sudo: required
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- name: "run test suite with python 3.7"
|
- name: "Run plugin test suite with python 3.7"
|
||||||
python: 3.7
|
python: 3.7
|
||||||
script: |
|
script: |
|
||||||
set -e
|
set -e
|
||||||
pytest
|
pytest
|
||||||
|
|
||||||
- name: "Lint with black"
|
- name: "Lint with black"
|
||||||
python: 3.7
|
python: 3.7
|
||||||
script: |
|
script: |
|
||||||
black --check --line-length=120 django-stubs/
|
black --check --line-length=120 django-stubs/
|
||||||
|
|
||||||
|
allow_failures:
|
||||||
|
- name: "Typecheck Django test suite"
|
||||||
|
python: 3.7
|
||||||
|
script: |
|
||||||
|
cd scripts
|
||||||
|
./typecheck_django_tests.xsh
|
||||||
|
|
||||||
before_install: |
|
before_install: |
|
||||||
# Upgrade pip, setuptools, and wheel
|
# Upgrade pip, setuptools, and wheel
|
||||||
pip install -U pip setuptools wheel
|
pip install -U pip setuptools wheel xonsh
|
||||||
|
|
||||||
install: |
|
install: |
|
||||||
pip install -r ./dev-requirements.txt
|
pip install -r ./dev-requirements.txt
|
||||||
|
|||||||
1
scripts/.gitignore
vendored
Normal file
1
scripts/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
django-sources/
|
||||||
14
scripts/typecheck_django_tests.xsh
Executable file
14
scripts/typecheck_django_tests.xsh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/local/bin/xonsh
|
||||||
|
|
||||||
|
import os
|
||||||
|
if not os.path.exists('./django-sources'):
|
||||||
|
git clone -b stable/2.1.x https://github.com/django/django.git django-sources
|
||||||
|
|
||||||
|
ignored_error_patterns = ["Need type annotation for"]
|
||||||
|
for line in $(mypy --config-file typecheck_tests.ini ./django-sources/tests/files).split('\n'):
|
||||||
|
for pattern in ignored_error_patterns:
|
||||||
|
if pattern in line:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print(line)
|
||||||
|
|
||||||
10
scripts/typecheck_tests.ini
Normal file
10
scripts/typecheck_tests.ini
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[mypy]
|
||||||
|
strict_optional = False
|
||||||
|
ignore_missing_imports = True
|
||||||
|
check_untyped_defs = True
|
||||||
|
warn_no_return = False
|
||||||
|
show_traceback = True
|
||||||
|
warn_redundant_casts = True
|
||||||
|
|
||||||
|
plugins =
|
||||||
|
mypy_django_plugin.main
|
||||||
Reference in New Issue
Block a user