Skip to content

Commit

Permalink
don't remove objects / DoesNotExist / etc. from model classes (#2)
Browse files Browse the repository at this point in the history
django-stubs fails to restore these in too many cases.  see upstream issue typeddjango#1744

(not upstreamed)
  • Loading branch information
asottile-sentry committed Sep 24, 2024
1 parent a788d6c commit ad18a32
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,6 @@ jobs:
- name: Run mypy on stubs
run: mypy --cache-dir=/dev/null --no-incremental django-stubs

test:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
shard: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup system dependencies
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -U pip setuptools wheel
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt
# Must match `shard` definition in the test matrix:
- name: Run pytest tests
run: PYTHONPATH='.' pytest --num-shards=4 --shard-id=${{ matrix.shard }} tests
- name: Run mypy on the test cases
run: mypy --strict tests/assert_type

stubtest:
timeout-minutes: 10
runs-on: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions mypy_django_plugin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
resolve_manager_method,
)
from mypy_django_plugin.transformers.models import (
MetaclassAdjustments,
handle_annotated_type,
process_model_class,
set_auth_user_model_boolean_fields,
Expand Down Expand Up @@ -231,7 +230,7 @@ def get_customize_class_mro_hook(self, fullname: str) -> Optional[Callable[[Clas

def get_metaclass_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]:
if fullname == fullnames.MODEL_METACLASS_FULLNAME:
return MetaclassAdjustments.adjust_model_class
return None
return None

def get_base_class_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]:
Expand Down

0 comments on commit ad18a32

Please sign in to comment.