mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Integrate django-scopes (#1319)
* Install django-scopes * Fix tests.api * Update tasks and cronjobs * Fix remaining tests * Remove unused import * Fix tests after rebase * Disable scopes for get_Events_with_any_permission * Disable scopes for a management command
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import inspect
|
||||
|
||||
import pytest
|
||||
from django_scopes import scopes_disabled
|
||||
from xdist.dsession import DSession
|
||||
|
||||
CRASHED_ITEMS = set()
|
||||
@@ -31,3 +34,16 @@ def pytest_configure(config):
|
||||
self.sched.check_schedule(node)
|
||||
|
||||
DSession.handle_crashitem = _handle_crashitem
|
||||
|
||||
|
||||
@pytest.hookimpl(hookwrapper=True)
|
||||
def pytest_fixture_setup(fixturedef, request):
|
||||
"""
|
||||
This hack automatically disables django-scopes for all fixtures which are not yield fixtures.
|
||||
This saves us a *lot* of decorcators…
|
||||
"""
|
||||
if inspect.isgeneratorfunction(fixturedef.func):
|
||||
yield
|
||||
else:
|
||||
with scopes_disabled():
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user