pytest-dev / pytest-dev/pytest-django

Add option to not setup Django in pytest_load_initial_conftests already

Open
#723 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
1.5k
Forks
367
PR merge metrics
No merged PRs in 30d

Description

pytest-django sets up Django in pytest_load_initial_conftests already, which requires you to use a pytest plugin yourself if you want to do anything before it, e.g. changing project settings for tests in the environment, before the settings get imported.
Using a pytest plugin has its issues though (https://github.com/pytest-dev/pytest/issues/5190).

To keep it backward compatible I think a new option could be used here, to either defer this to pytest_configure, or skip it completely (but providing a way to call it manually).

Ref: https://github.com/pytest-dev/pytest-django/pull/719

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the pytest_load_initial_conftests and pytest_configure entry points, along with the linked pytest issue and PR 719. Define how the new option should defer, skip, and manually invoke Django setup while preserving existing behavior; done means the lifecycle is documented and covered by tests for each mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.