pytest-dev / pytest-dev/pytest-django

More granular database fixtures

Open
#247 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

A lot of issues reported would benefit from a more general approach to hooking into/overriding how pytest-django's internal fixtures with regard to managing the database. This issue is a place to collect related issues that should be solved when re-thinking/re-organizing the fixtures.

The (now quite old) branch https://github.com/pytest-dev/pytest-django/tree/fixturefix is the place where I have been experimenting with ideas in this area.

Support hooking into database creation:

  • #37 - alternative database setup schemes - use copy with sqlite / CREATE DATABASE foo TEMPLATE template0;
  • #98 - disable xdist suffix - customize test database name
  • #84 - custom sequences - make it possible to run code after test database is created

Support having database fixtures in session, module, class scope:

  • #105 - Do common db setup between tests once
  • #243 - Support database access for "session" level fixtures

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 reviewing the fixturefix branch and the related issues listed in this report, especially #37, #98, #84, #105, and #243. Determine a coherent design for database-creation hooks and session, module, and class-scoped database fixtures. Done means the related use cases are supported through a reorganized fixture system.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, databases, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.