File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,14 @@ Changelog
44v4.12.1 (unreleased)
55--------------------
66
7+ Improvements
8+ ^^^^^^^^^^^^
9+
10+ * Exposed :class: `~pytest_django.SettingsWrapper ` from the top-level
11+ :mod: `pytest_django ` namespace so the :fixture: `settings ` fixture can be
12+ type-annotated without reaching into ``pytest_django.fixtures ``
13+ (`#1257 <https://github.com/pytest-dev/pytest-django/issues/1257 >`__).
14+
715Bugfixes
816^^^^^^^^
917
Original file line number Diff line number Diff line change @@ -442,6 +442,13 @@ Example
442442 settings.USE_TZ = True
443443 assert settings.USE_TZ
444444
445+ If you use type annotations, you can annotate the fixture like this::
446+
447+ from pytest_django import SettingsWrapper
448+
449+ def test_with_specific_settings(settings: SettingsWrapper):
450+ ...
451+
445452
446453.. fixture :: django_assert_num_queries
447454
Original file line number Diff line number Diff line change 55 __version__ = "unknown"
66
77
8- from .fixtures import DjangoAssertNumQueries , DjangoCaptureOnCommitCallbacks
8+ from .fixtures import DjangoAssertNumQueries , DjangoCaptureOnCommitCallbacks , SettingsWrapper
99from .plugin import DjangoDbBlocker
1010
1111
1212__all__ = [
1313 "DjangoAssertNumQueries" ,
1414 "DjangoCaptureOnCommitCallbacks" ,
1515 "DjangoDbBlocker" ,
16+ "SettingsWrapper" ,
1617 "__version__" ,
1718]
Original file line number Diff line number Diff line change @@ -461,6 +461,13 @@ def test_set_non_existent(settings):
461461 ]
462462 )
463463
464+ def test_settings_wrapper_is_publicly_reexported (self ) -> None :
465+ import pytest_django
466+ from pytest_django .fixtures import SettingsWrapper as _Wrapper
467+
468+ assert "SettingsWrapper" in pytest_django .__all__
469+ assert pytest_django .SettingsWrapper is _Wrapper
470+
464471
465472class TestLiveServer :
466473 @pytest .mark .skipif ("PYTEST_XDIST_WORKER" in os .environ , reason = "xdist in use" )
You can’t perform that action at this time.
0 commit comments