pytest-dev / pytest-dev/pytest-django
ContentTypes cache not cleared between tests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
We've been testing our query counts, and found our tests weren't independent due to the caching of ContentTypes causing query counts to depend on test ordering.
There's a handy pytest-django fixture for clearing the Sites cache but not one for ContentTypes.
Is this something that would be accepted as an addition to this library? It would call ContentType.objects.clear_cache()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the existing Sites-cache fixture in pytest_django/plugin.py with Django's ContentType.objects.clear_cache(). Run the relevant pytest-django test suite to understand fixture conventions. Done means the library provides a ContentTypes cache-clearing fixture and tests remain independent of ordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100