pytest-dev / pytest-dev/pytest-django

Error message for database access in setup_X is misleading

Open
#297 2 comments 8 reactions 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

The error message when triggering the database from setup_X methods should clearly point out that database access from such methods is not supported, rather than advising to put the django_db marker on the test.

See http://stackoverflow.com/questions/34089425/django-pytest-setup-method-database-issue for original problem.

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 locating the setup_X methods and the database-access error they produce, using the linked Stack Overflow report for context. Update the message so it explains that database access from setup_X methods is unsupported rather than recommending the django_db marker, then verify the affected error behavior with the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
databases, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.