Use pytest for tests (#681)

* use pytest for tests

Eh ouais, il y a que la config qui change. Pytest est implémentable par étapes. Et ça c'est beau.

* rework tests with pytest

* remove unittest custom TestRunner

* Edit doc and CI
This commit is contained in:
thomas girod
2024-06-26 19:10:24 +02:00
committed by GitHub
parent a5cbac1f97
commit d97602e60b
19 changed files with 1268 additions and 1515 deletions

View File

@ -57,6 +57,7 @@ SECRET_KEY = "(4sjxvhz@m5$0a$j0_pqicnc$s!vbve)z+&++m%g%bjhlz4+g2"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TESTING = "pytest" in sys.modules
INTERNAL_IPS = ["127.0.0.1"]
ALLOWED_HOSTS = ["*"]
@ -113,8 +114,6 @@ MIDDLEWARE = (
"core.middleware.SignalRequestMiddleware",
)
TEST_RUNNER = "sith.testrunner.SithTestRunner"
ROOT_URLCONF = "sith.urls"
TEMPLATES = [
@ -697,7 +696,7 @@ if DEBUG:
SASS_INCLUDE_FOLDERS = ["core/static/"]
SENTRY_ENV = "development"
if "test" in sys.argv:
if TESTING:
CAPTCHA_TEST_MODE = True
if SENTRY_DSN:

View File

@ -1,9 +0,0 @@
from django.core.management import call_command
from django.test.runner import DiscoverRunner
class SithTestRunner(DiscoverRunner):
def setup_databases(self, **kwargs):
res = super().setup_databases(**kwargs)
call_command("populate")
return res