From 4cee7e95693fab89dbe840a4801490b3e9e7a8b6 Mon Sep 17 00:00:00 2001 From: TianyangZhang Date: Tue, 24 Mar 2026 17:06:18 +0800 Subject: [PATCH] chore: add pytest configuration for Django tests --- offer_backend/conftest.py | 7 +++++++ offer_backend/pytest.ini | 5 +++++ offer_backend/requirements.txt | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 offer_backend/conftest.py create mode 100644 offer_backend/pytest.ini diff --git a/offer_backend/conftest.py b/offer_backend/conftest.py new file mode 100644 index 0000000..12c8f62 --- /dev/null +++ b/offer_backend/conftest.py @@ -0,0 +1,7 @@ +import pytest +from django.test import Client + + +@pytest.fixture +def client(): + return Client() diff --git a/offer_backend/pytest.ini b/offer_backend/pytest.ini new file mode 100644 index 0000000..5ca899c --- /dev/null +++ b/offer_backend/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +DJANGO_SETTINGS_MODULE = config.settings.development +python_files = tests/test_*.py +python_classes = Test* +python_functions = test_* diff --git a/offer_backend/requirements.txt b/offer_backend/requirements.txt index 8b13725..ebc1a8f 100644 --- a/offer_backend/requirements.txt +++ b/offer_backend/requirements.txt @@ -8,3 +8,5 @@ redis==5.0.1 django-redis==5.4.0 Pillow==10.3.0 python-decouple==3.8 +pytest==8.1.1 +pytest-django==4.8.0