Skip to content

feat: re-export Settings from pytest_django for typing (#1257) - #1280

Merged
bluetech merged 1 commit into
pytest-dev:mainfrom
SAY-5:export-settings-wrapper
Aug 3, 2026
Merged

feat: re-export Settings from pytest_django for typing (#1257)#1280
bluetech merged 1 commit into
pytest-dev:mainfrom
SAY-5:export-settings-wrapper

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 21, 2026

Copy link
Copy Markdown

Closes #1257.

SettingsWrapper is now importable from the top-level pytest_django namespace so the settings fixture can be type-annotated without reaching into pytest_django.fixtures:

from pytest_django import SettingsWrapper

def test_with_specific_settings(settings: SettingsWrapper):
    ...

Mirrors the existing pattern used for DjangoAssertNumQueries and DjangoCaptureOnCommitCallbacks.

  • adds SettingsWrapper to pytest_django.__all__
  • documents the typing usage under the settings fixture in docs/helpers.rst
  • changelog entry under v4.12.1
  • regression test in TestSettings

@SAY-5
SAY-5 force-pushed the export-settings-wrapper branch from 52df77a to b0ca5ec Compare May 21, 2026 06:55
@kingbuzzman
kingbuzzman requested a review from bluetech August 3, 2026 13:52
@bluetech
bluetech force-pushed the export-settings-wrapper branch from b0ca5ec to 367d72b Compare August 3, 2026 14:29

@bluetech bluetech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I updated the PR according to my comments in the issue: #1257 (comment)

@bluetech bluetech changed the title feat: re-export SettingsWrapper from pytest_django for typing (#1257) feat: re-export Settings from pytest_django for typing (#1257) Aug 3, 2026
@bluetech
bluetech merged commit dd53071 into pytest-dev:main Aug 3, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typing support for settings fixture?

2 participants