mirror of
https://github.com/pretix/pretix.git
synced 2026-08-22 12:42:00 +00:00
repair tests
This commit is contained in:
@@ -15,7 +15,7 @@ Core
|
||||
item_copy_data, register_sales_channel_types, register_global_settings, quota_availability, global_email_filter,
|
||||
register_ticket_secret_generators, gift_card_transaction_display,
|
||||
register_text_placeholders, register_mail_placeholders, device_info_updated,
|
||||
register_event_permission_groups, register_organizer_permission_groups
|
||||
register_event_permission_groups, register_organizer_permission_groups, self_service_cancellation_checks
|
||||
|
||||
Order events
|
||||
""""""""""""
|
||||
|
||||
@@ -129,6 +129,7 @@ dev = [
|
||||
"pytest==9.1.*",
|
||||
"playwright",
|
||||
"responses",
|
||||
"django-stubs-ext"
|
||||
]
|
||||
|
||||
[project.entry-points."distutils.commands"]
|
||||
|
||||
@@ -349,7 +349,7 @@ class Cancellation(models.Model):
|
||||
)
|
||||
|
||||
cancellation_state = models.CharField(
|
||||
max_length=8,
|
||||
max_length=16,
|
||||
choices=CANCELLATION_STATE,
|
||||
default=CREATED,
|
||||
verbose_name=_("State of the cancellation"),
|
||||
|
||||
@@ -301,7 +301,7 @@ def ensure_no_queries():
|
||||
:return:
|
||||
"""
|
||||
def blocker(*args, **kwargs):
|
||||
if settings.DEBUG or "PYTEST_CURRENT_TEST" in os.environ:
|
||||
if settings.DEBUG or "PYTEST_CURRENT_TEST" in os.environ and not "ENSURE_NO_QUERIES_OVERRIDE" in os.environ:
|
||||
raise RuntimeError(f"Unexpected DB query: {args[1]}")
|
||||
logger.error("Unexpected DB query: %s", args[1])
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ No mocking is used: every test runs against a real database connection via the
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from django_scopes import scopes_disabled
|
||||
@@ -28,6 +29,7 @@ def test_raises_runtime_error_in_debug(settings):
|
||||
@pytest.mark.django_db
|
||||
def test_logs_error_when_not_debug(settings, caplog):
|
||||
settings.DEBUG = False
|
||||
os.environ.setdefault("ENSURE_NO_QUERIES_OVERRIDE", "true")
|
||||
|
||||
with caplog.at_level(logging.ERROR):
|
||||
with scopes_disabled():
|
||||
|
||||
Reference in New Issue
Block a user