chore: migrate from pytest.ini -> pyproject.toml

ref: #731 #730
This commit is contained in:
2025-04-20 13:35:23 +09:30
parent 705b245514
commit 6289fad8ad
7 changed files with 57 additions and 23 deletions

27
app/conftest.py Normal file
View File

@ -0,0 +1,27 @@
import pytest
from django.test import (
TestCase
)
def pytest_pycollect_makeitem(collector, name, obj):
"""PyTest Test Creation
Create PyTest Test Classes if the classname ends in `Test`
and is not inheriting from django,test.TestCase.
"""
if (
isinstance(obj, type)
and name.endswith("PyTest")
and not issubclass(obj, TestCase) # Don't pickup any django unittest.TestCase
):
return pytest.Class.from_parent(parent=collector, name=name)
@pytest.fixture(autouse=True)
def enable_db_access_for_all_tests(db): # pylint: disable=W0613:unused-argument
pass

View File

@ -1,8 +0,0 @@
[pytest]
DJANGO_SETTINGS_MODULE = app.settings
# -- recommended but optional:
python_files = tests.py test_*.py *_tests.py
log_cli = 1
log_cli_level = INFO
log_cli_format = %(asctime)s %(levelname)s %(message)s
log_cli_date_format = %Y-%m-%d %H:%M:%S