pytest-dev / pytest-dev/pytest-bdd

How to add the ``django_db`` mark to automatically generated tests?

Open
#215 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
251
Avg merge
43m
Merged PRs (30d)
2

Description

I keep getting this error from pytest-django:

Failed: Database access not allowed, use the "django_db" mark, or the "db" or "transactional_db" fixtures to enable it.

However, I don't know how to add the django_db mark to tests automatically created with the scenarios() function. Some sort of documentation on how to do this would be great.

I also suspect this is the underlying reason for #187.

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 scenarios() entry point and the discussion in issue #187 to understand how generated tests interact with pytest-django. Document how the django_db mark, db fixture, or transactional_db fixture can be applied to these tests, and verify the documented approach against the reported database-access error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.