Update contributing guidelines to include pytest decorator for database tests

This commit is contained in:
Genaro Camele 2025-10-13 21:18:52 -03:00
parent 9da97c90f8
commit 542d4dc388

View File

@ -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.
---