Skip to content

Remove typecheck test and clean things up #1556

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 5 commits into from
Jun 21, 2023
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
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,3 @@ jobs:

- name: Run django-stubs-ext tests
run: PYTHONPATH='.' pytest django_stubs_ext

- name: Run typecheck
run: python ./scripts/typecheck_tests.py --django_version="${{ matrix.django-version }}"
7 changes: 0 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ If you get some unexpected results or want to be sure that tests run is not affe
rm -r .mypy_cache
```

We also test the stubs against Django's own test suite. This is done in CI but you can also do this locally.
To execute the script run:

```bash
python ./scripts/typecheck_tests.py --django_version 3.2
```


### Generating Stubs using Stubgen

Expand Down
23 changes: 12 additions & 11 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# Regular configuration file (can be used as base in other projects, runs in CI)

[mypy]
allow_redefinition = True
check_untyped_defs = True
ignore_missing_imports = True
incremental = True
strict_optional = True
show_traceback = True
warn_unused_ignores = True
warn_redundant_casts = True
warn_unused_configs = True
warn_unreachable = True
allow_redefinition = true
check_untyped_defs = true
ignore_missing_imports = true
incremental = true
strict_optional = true
show_traceback = true
warn_unused_ignores = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unreachable = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
show_error_codes = False
show_error_codes = false
disable_error_code = empty-body


plugins =
mypy_django_plugin.main

Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
black==23.3.0
requests==2.31.0
gitpython==3.1.31
pre-commit==3.3.3
pytest==7.3.2
pytest-mypy-plugins==1.11.1
Expand Down
239 changes: 2 additions & 237 deletions scripts/django_tests_settings.py
Original file line number Diff line number Diff line change
@@ -1,237 +1,2 @@
import os

import django

SECRET_KEY = "1"
SITE_ID = 1

INSTALLED_APPS = [
"django.contrib.contenttypes",
"django.contrib.auth",
"django.contrib.sites",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.admin.apps.SimpleAdminConfig",
"django.contrib.staticfiles",
]

test_modules = [
"absolute_url_overrides",
"admin_autodiscover",
"admin_changelist",
"admin_checks",
"admin_custom_urls",
"admin_default_site",
"admin_docs",
"admin_filters",
"admin_inlines",
"admin_ordering",
"admin_registration",
"admin_scripts",
"admin_utils",
"admin_views",
"admin_widgets",
"aggregation",
"aggregation_regress",
"annotations",
"app_loading",
"apps",
"auth_tests",
"backends",
"base",
"bash_completion",
"basic",
"builtin_server",
"bulk_create",
"cache",
"check_framework",
"conditional_processing",
"constraints",
"contenttypes_tests",
"context_processors",
"csrf_tests",
"custom_columns",
"custom_lookups",
"custom_managers",
"custom_methods",
"custom_migration_operations",
"custom_pk",
"datatypes",
"dates",
"datetimes",
"db_functions",
"db_typecasts",
"db_utils",
"dbshell",
"decorators",
"defer",
"defer_regress",
"delete",
"delete_regress",
"deprecation",
"dispatch",
"distinct_on_fields",
"empty",
"expressions",
"expressions_case",
"expressions_window",
"extra_regress",
"field_deconstruction",
"field_defaults",
"field_subclassing",
"file_storage",
"file_uploads",
"files",
"filtered_relation",
"fixtures",
"fixtures_model_package",
"fixtures_regress",
"flatpages_tests",
"force_insert_update",
"foreign_object",
"forms_tests",
"from_db_value",
"generic_inline_admin",
"generic_relations",
"generic_relations_regress",
"generic_views",
"get_earliest_or_latest",
"get_object_or_404",
"get_or_create",
"gis_tests",
"handlers",
"httpwrappers",
"humanize_tests",
"i18n",
"import_error_package",
"indexes",
"inline_formsets",
"inspectdb",
"introspection",
"invalid_models_tests",
"known_related_objects",
"logging_tests",
"lookup",
"m2m_and_m2o",
"m2m_intermediary",
"m2m_multiple",
"m2m_recursive",
"m2m_regress",
"m2m_signals",
"m2m_through",
"m2m_through_regress",
"m2o_recursive",
"mail",
"managers_regress",
"many_to_many",
"many_to_one",
"many_to_one_null",
"max_lengths",
"messages_tests",
"middleware",
"middleware_exceptions",
"migrate_signals",
"migration_test_data_persistence",
"migrations",
"migrations2",
"model_fields",
"model_forms",
"model_formsets",
"model_formsets_regress",
"model_indexes",
"model_inheritance",
"model_inheritance_regress",
"model_meta",
"model_options",
"model_package",
"model_regress",
"modeladmin",
"multiple_database",
"mutually_referential",
"nested_foreign_keys",
"no_models",
"null_fk",
"null_fk_ordering",
"null_queries",
"one_to_one",
"or_lookups",
"order_with_respect_to",
"ordering",
"pagination",
"postgres_tests",
"prefetch_related",
"project_template",
"properties",
"proxy_model_inheritance",
"proxy_models",
"queries",
"queryset_pickle",
"raw_query",
"redirects_tests",
"requests",
"reserved_names",
"resolve_url",
"responses",
"reverse_lookup",
"save_delete_hooks",
"schema",
"select_for_update",
"select_related",
"select_related_onetoone",
"select_related_regress",
"serializers",
"servers",
"sessions_tests",
"settings_tests",
"shell",
"shortcuts",
"signals",
"signed_cookies_tests",
"signing",
"sitemaps_tests",
"sites_framework",
"sites_tests",
"staticfiles_tests",
"str",
"string_lookup",
"swappable_models",
"syndication_tests",
"template_backends",
"template_loader",
"template_tests",
"test_client",
"test_client_regress",
"test_exceptions",
"test_runner",
"test_runner_apps",
"test_utils",
"timezones",
"transaction_hooks",
"transactions",
"unmanaged_models",
"update",
"update_only_fields",
"urlpatterns",
"urlpatterns_reverse",
"user_commands",
"utils_tests",
"validation",
"validators",
"version",
"view_tests",
"wsgi",
]

if django.VERSION[0] == 2:
test_modules += ["choices"]

invalid_apps = {
"import_error_package",
}

for app in invalid_apps:
test_modules.remove(app)


if os.environ.get("TYPECHECK_TESTS"):
INSTALLED_APPS += test_modules
# It is used in `mypy.ini` only.
# It is empty, because we don't need any specific values.
Loading