Merge pull request #5455 from tsiegleauq/another-travis-fix

Pin isort, repair tests
This commit is contained in:
Finn Stutzenstein 2020-07-08 07:16:27 +02:00 committed by GitHub
commit 9eeb287425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 35 additions and 32 deletions

View File

@ -9,9 +9,12 @@ class AgendaAppConfig(AppConfig):
def ready(self): def ready(self):
# Import all required stuff. # Import all required stuff.
from django.db.models.signals import pre_delete, post_save from django.db.models.signals import post_save, pre_delete
from ..core.signals import permission_change from ..core.signals import permission_change
from ..utils.access_permissions import required_user
from ..utils.rest_api import router from ..utils.rest_api import router
from . import serializers # noqa
from .projector import register_projector_slides from .projector import register_projector_slides
from .signals import ( from .signals import (
get_permission_change_data, get_permission_change_data,
@ -19,8 +22,6 @@ class AgendaAppConfig(AppConfig):
listen_to_related_object_post_save, listen_to_related_object_post_save,
) )
from .views import ItemViewSet, ListOfSpeakersViewSet from .views import ItemViewSet, ListOfSpeakersViewSet
from . import serializers # noqa
from ..utils.access_permissions import required_user
# Define projector elements. # Define projector elements.
register_projector_slides() register_projector_slides()

View File

@ -16,9 +16,9 @@ class AssignmentsAppConfig(AppConfig):
from .projector import register_projector_slides from .projector import register_projector_slides
from .signals import get_permission_change_data from .signals import get_permission_change_data
from .views import ( from .views import (
AssignmentViewSet,
AssignmentPollViewSet,
AssignmentOptionViewSet, AssignmentOptionViewSet,
AssignmentPollViewSet,
AssignmentViewSet,
AssignmentVoteViewSet, AssignmentVoteViewSet,
) )
@ -82,7 +82,7 @@ async def required_users_assignments(element: Dict[str, Any]) -> Set[int]:
Returns all user ids that are displayed as candidates (including poll Returns all user ids that are displayed as candidates (including poll
options) in the assignment element. options) in the assignment element.
""" """
from openslides.assignments.models import AssignmentPoll, AssignmentOption from openslides.assignments.models import AssignmentOption, AssignmentPoll
from openslides.utils.cache import element_cache from openslides.utils.cache import element_cache
candidates = set( candidates = set(

View File

@ -15,9 +15,12 @@ class CoreAppConfig(AppConfig):
def ready(self): def ready(self):
# Import all required stuff. # Import all required stuff.
# Let all client websocket message register
from ..utils import websocket_client_messages # noqa
from ..utils.rest_api import router
from . import serializers # noqa
from .config import config from .config import config
from .projector import register_projector_slides from .projector import register_projector_slides
from . import serializers # noqa
from .signals import ( from .signals import (
autoupdate_for_many_to_many_relations, autoupdate_for_many_to_many_relations,
cleanup_unused_permissions, cleanup_unused_permissions,
@ -29,15 +32,11 @@ class CoreAppConfig(AppConfig):
from .views import ( from .views import (
ConfigViewSet, ConfigViewSet,
CountdownViewSet, CountdownViewSet,
ProjectionDefaultViewSet,
ProjectorMessageViewSet, ProjectorMessageViewSet,
ProjectorViewSet, ProjectorViewSet,
ProjectionDefaultViewSet,
TagViewSet, TagViewSet,
) )
from ..utils.rest_api import router
# Let all client websocket message register
from ..utils import websocket_client_messages # noqa
# Collect all config variables before getting the constants. # Collect all config variables before getting the constants.
config.collect_config_variables_from_apps() config.collect_config_variables_from_apps()
@ -92,9 +91,9 @@ class CoreAppConfig(AppConfig):
run_startup_hooks() run_startup_hooks()
def get_startup_hooks(self): def get_startup_hooks(self):
from openslides.utils.constants import set_constants_from_apps
from openslides.utils.cache import element_cache
from openslides.core.models import History from openslides.core.models import History
from openslides.utils.cache import element_cache
from openslides.utils.constants import set_constants_from_apps
return { return {
10: element_cache.ensure_schema_version, 10: element_cache.ensure_schema_version,

View File

@ -11,10 +11,11 @@ class MediafilesAppConfig(AppConfig):
# Import all required stuff. # Import all required stuff.
from openslides.core.signals import permission_change from openslides.core.signals import permission_change
from openslides.utils.rest_api import router from openslides.utils.rest_api import router
from . import serializers # noqa
from .projector import register_projector_slides from .projector import register_projector_slides
from .signals import get_permission_change_data from .signals import get_permission_change_data
from .views import MediafileViewSet from .views import MediafileViewSet
from . import serializers # noqa
# Validate, that the media_url is correct formatted: # Validate, that the media_url is correct formatted:
# Must begin and end with a slash. It has to be at least "/". # Must begin and end with a slash. It has to be at least "/".

View File

@ -12,23 +12,24 @@ class MotionsAppConfig(AppConfig):
# Import all required stuff. # Import all required stuff.
from openslides.core.signals import permission_change from openslides.core.signals import permission_change
from openslides.utils.rest_api import router from openslides.utils.rest_api import router
from ..utils.access_permissions import required_user
from . import serializers # noqa
from .projector import register_projector_slides from .projector import register_projector_slides
from .signals import create_builtin_workflows, get_permission_change_data from .signals import create_builtin_workflows, get_permission_change_data
from . import serializers # noqa
from .views import ( from .views import (
CategoryViewSet, CategoryViewSet,
StatuteParagraphViewSet,
MotionViewSet,
MotionCommentSectionViewSet,
MotionVoteViewSet,
MotionBlockViewSet, MotionBlockViewSet,
MotionPollViewSet,
MotionOptionViewSet,
MotionChangeRecommendationViewSet, MotionChangeRecommendationViewSet,
MotionCommentSectionViewSet,
MotionOptionViewSet,
MotionPollViewSet,
MotionViewSet,
MotionVoteViewSet,
StateViewSet, StateViewSet,
StatuteParagraphViewSet,
WorkflowViewSet, WorkflowViewSet,
) )
from ..utils.access_permissions import required_user
# Define projector elements. # Define projector elements.
register_projector_slides() register_projector_slides()

View File

@ -8,11 +8,12 @@ class TopicsAppConfig(AppConfig):
def ready(self): def ready(self):
# Import all required stuff. # Import all required stuff.
from openslides.core.signals import permission_change from openslides.core.signals import permission_change
from ..utils.rest_api import router from ..utils.rest_api import router
from . import serializers # noqa
from .projector import register_projector_slides from .projector import register_projector_slides
from .signals import get_permission_change_data from .signals import get_permission_change_data
from .views import TopicViewSet from .views import TopicViewSet
from . import serializers # noqa
# Define projector elements. # Define projector elements.
register_projector_slides() register_projector_slides()

View File

@ -19,8 +19,8 @@ class UserAccessPermissions(BaseAccessPermissions):
not get the fields they should not get. not get the fields they should not get.
""" """
from .serializers import ( from .serializers import (
USERCANSEESERIALIZER_FIELDS,
USERCANSEEEXTRASERIALIZER_FIELDS, USERCANSEEEXTRASERIALIZER_FIELDS,
USERCANSEESERIALIZER_FIELDS,
) )
def filtered_data(full_data, whitelist, whitelist_operator=None): def filtered_data(full_data, whitelist, whitelist_operator=None):

View File

@ -12,9 +12,9 @@ class UsersAppConfig(AppConfig):
def ready(self): def ready(self):
# Import all required stuff. # Import all required stuff.
from . import serializers # noqa from ..core.signals import permission_change, post_permission_creation
from ..core.signals import post_permission_creation, permission_change
from ..utils.rest_api import router from ..utils.rest_api import router
from . import serializers # noqa
from .projector import register_projector_slides from .projector import register_projector_slides
from .signals import create_builtin_groups_and_admin, get_permission_change_data from .signals import create_builtin_groups_and_admin, get_permission_change_data
from .views import GroupViewSet, PersonalNoteViewSet, UserViewSet from .views import GroupViewSet, PersonalNoteViewSet, UserViewSet

View File

@ -20,7 +20,7 @@ from .utils import split_element_id, str_dict_to_bytes
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
if use_redis: if use_redis:
from .redis import get_connection, aioredis from .redis import aioredis, get_connection
class CacheReset(Exception): class CacheReset(Exception):

View File

@ -1,7 +1,7 @@
black black
coverage coverage
flake8 flake8
isort isort<5.0.0
mypy mypy
pytest<5.4.2 pytest<5.4.2
pytest-django<3.9.0 pytest-django<3.9.0

View File

@ -64,7 +64,7 @@ def constants(request, reset_cache):
Uses fake constants, if the db is not in use. Uses fake constants, if the db is not in use.
""" """
from openslides.utils.constants import set_constants, get_constants_from_apps from openslides.utils.constants import get_constants_from_apps, set_constants
if "django_db" in request.node.keywords or is_django_unittest(request): if "django_db" in request.node.keywords or is_django_unittest(request):
# When the db is created, use the original constants # When the db is created, use the original constants

View File

@ -1,7 +1,6 @@
""" """
Settings file for OpenSlides' tests. Settings file for OpenSlides' tests.
""" """
import os import os
from openslides.global_settings import * # noqa from openslides.global_settings import * # noqa
@ -82,7 +81,8 @@ ENABLE_ELECTRONIC_VOTING = True
# https://stackoverflow.com/questions/24876343/django-traceback-on-queries # https://stackoverflow.com/questions/24876343/django-traceback-on-queries
if os.environ.get("DEBUG_SQL_TRACEBACK"): if os.environ.get("DEBUG_SQL_TRACEBACK"):
import traceback import traceback
import django.db.backends.utils as bakutils
from django.db.backends import utils as bakutils
cursor_debug_wrapper_orig = bakutils.CursorDebugWrapper cursor_debug_wrapper_orig = bakutils.CursorDebugWrapper