mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-01-27 05:12:11 +08:00
Fix CI (#1108)
* Fix CI
* Fix CI
* Fix CI
* Fix CI
* APply black
* APply black
* Fix mypy
* Fix mypy errors in django-stubs
* Fix format
* Fix plugin
* Do not patch builtins by default
* Fix mypy
* Only run mypy on 3.10 for now
* Only run mypy on 3.10 for now
* WHAT THE HELL
* Enable strict mode in mypy
* Enable strict mode in mypy
* Fix tests
* Fix tests
* Debug
* Debug
* Fix tests
* Fix tests
* Add TYPE_CHECKING debug
* Caching maybe?
* Caching maybe?
* Try explicit `${{ matrix.python-version }}`
* Remove debug
* Fix typing
* Finally
This commit is contained in:
@@ -5,6 +5,7 @@ from pytest_mypy_plugins.item import YamlTestItem
|
||||
def django_plugin_hook(test_item: YamlTestItem) -> None:
|
||||
custom_settings = test_item.parsed_test_data.get("custom_settings", "")
|
||||
installed_apps = test_item.parsed_test_data.get("installed_apps", None)
|
||||
monkeypatch = test_item.parsed_test_data.get("monkeypatch", False)
|
||||
|
||||
if installed_apps and custom_settings:
|
||||
raise ValueError('"installed_apps" and "custom_settings" are not compatible, please use one or the other')
|
||||
@@ -18,6 +19,9 @@ def django_plugin_hook(test_item: YamlTestItem) -> None:
|
||||
if "SECRET_KEY" not in custom_settings:
|
||||
custom_settings = 'SECRET_KEY = "1"\n' + custom_settings
|
||||
|
||||
if monkeypatch:
|
||||
custom_settings = "import django_stubs_ext\ndjango_stubs_ext.monkeypatch()\n" + custom_settings
|
||||
|
||||
django_settings_section = "\n[mypy.plugins.django-stubs]\n" "django_settings_module = mysettings"
|
||||
if not test_item.additional_mypy_config:
|
||||
test_item.additional_mypy_config = django_settings_section
|
||||
|
||||
Reference in New Issue
Block a user