From 542d4dc388e81c02d5ed4699985d2e93c1a76f2a Mon Sep 17 00:00:00 2001 From: Genaro Camele Date: Mon, 13 Oct 2025 21:18:52 -0300 Subject: [PATCH] Update contributing guidelines to include pytest decorator for database tests --- docs/community/contributing.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/community/contributing.md b/docs/community/contributing.md index 5be0072db..797bf72e3 100644 --- a/docs/community/contributing.md +++ b/docs/community/contributing.md @@ -83,9 +83,9 @@ To run the tests, clone the repository, and then: --- -**Note:** -If your tests require access to the database, do not forget to inherit from `django.test.TestCase`. -For example: +**Note:** if your tests require access to the database, do not forget to inherit from `django.test.TestCase` or use the `@pytest.mark.django_db()` decorator. + +For example, with TestCase: from django.test import TestCase @@ -94,6 +94,16 @@ For example: # Your test code here pass +Or with decorator: + + import pytest + + @pytest.mark.django_db() + class MyDatabaseTest: + def test_something(self): + # Your test code here + pass + You can reuse existing models defined in `tests/models.py` for your tests. ---