From 71a6b530dab3059de3cd0558f26cf415966e3300 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Wed, 24 Apr 2024 10:13:32 +0300 Subject: [PATCH 1/2] Fix CI: suppress mypy errors in test suite that come from 3rd party packages (#596) * Fix CI (maybe) * Fix CI (maybe) --- .github/workflows/test.yml | 3 ++- mypy.ini | 20 -------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b2368bd2..249269918 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,7 +61,8 @@ jobs: SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt - name: Run tests - run: pytest + # Suppress errors from other packages due to https://github.com/typeddjango/pytest-mypy-plugins/issues/134 + run: pytest --mypy-only-local-stub stubtest: timeout-minutes: 10 diff --git a/mypy.ini b/mypy.ini index 79c93df01..e140bf240 100644 --- a/mypy.ini +++ b/mypy.ini @@ -23,23 +23,3 @@ plugins = [mypy.plugins.django-stubs] django_settings_module = scripts.drf_tests_settings - -# Suppress errors from site-packages due to https://github.com/typeddjango/pytest-mypy-plugins/issues/134 -[mypy-uritemplate.*] -warn_unreachable = false - -[mypy-yaml.*] -disallow_untyped_defs = false -disallow_incomplete_defs = false - -[mypy-urllib3.*] -disallow_untyped_defs = false -disallow_incomplete_defs = false - -[mypy-requests.*] -disallow_untyped_defs = false -disallow_incomplete_defs = false - -[mypy-markdown.*] -disallow_untyped_defs = false -disallow_incomplete_defs = false From 9d255037e718ae91a7c2a6aad4ab18b9f0c35d50 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Wed, 24 Apr 2024 10:17:17 +0300 Subject: [PATCH 2/2] Make HyperlinkedModelSerializer generic (#595) Co-authored-by: Nikita Sobolev --- rest_framework-stubs/serializers.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework-stubs/serializers.pyi b/rest_framework-stubs/serializers.pyi index 833005d17..c7c3e3737 100644 --- a/rest_framework-stubs/serializers.pyi +++ b/rest_framework-stubs/serializers.pyi @@ -263,4 +263,4 @@ class ModelSerializer(Serializer, BaseSerializer[_MT]): def get_unique_together_validators(self) -> list[UniqueTogetherValidator]: ... def get_unique_for_date_validators(self) -> list[BaseUniqueForValidator]: ... -class HyperlinkedModelSerializer(ModelSerializer): ... +class HyperlinkedModelSerializer(ModelSerializer[_MT]): ...