Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies = [
"channels_redis~=4.3.0",
# Storage requirement for computing hashes.
"crcmod",
"Django~=5.2.7",
"Django~=6.0",
"django-fernet-fields-v2~=0.9",
"django-filter~=25.2",
"djangorestframework~=3.16.1",
Expand Down
2 changes: 1 addition & 1 deletion resolwe/flow/migrations/0008_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="annotationfield",
constraint=models.CheckConstraint(
check=models.Q(("type__in", ["DATE", "DECIMAL", "INTEGER", "STRING"])),
condition=models.Q(("type__in", ["DATE", "DECIMAL", "INTEGER", "STRING"])),
name="annotation_type",
),
),
Expand Down
2 changes: 1 addition & 1 deletion resolwe/flow/models/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class Meta:
constraints = [
# Accept only supported annotation types.
models.constraints.CheckConstraint(
check=models.Q(type__in=[e.value for e in AnnotationType]),
condition=models.Q(type__in=[e.value for e in AnnotationType]),
name="annotation_type",
),
models.constraints.UniqueConstraint(
Expand Down
2 changes: 1 addition & 1 deletion resolwe/flow/models/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, expression, path):
def as_sql(self, compiler, connection):
"""Compile SQL for this function."""
sql, params = super().as_sql(compiler, connection)
params.append(self.path)
params = params + (self.path,)
return sql, params


Expand Down
2 changes: 1 addition & 1 deletion resolwe/permissions/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="permissionmodel",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
models.Q(("group__isnull", True), ("user__isnull", False)),
models.Q(("group__isnull", False), ("user__isnull", True)),
_connector="OR",
Expand Down
2 changes: 1 addition & 1 deletion resolwe/permissions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class Meta:
condition=models.Q(group__isnull=False),
),
models.CheckConstraint(
check=models.Q(user__isnull=False, group__isnull=True)
condition=models.Q(user__isnull=False, group__isnull=True)
| models.Q(user__isnull=True, group__isnull=False),
name="exactly_one_of_user_group_must_be_set",
),
Expand Down
33 changes: 10 additions & 23 deletions resolwe/test_helpers/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@

from . import TESTING_CONTEXT

# Python 3.14 uses forkserver by default, which is not supported by Django.
# Remove the line bellow after Django fixes the issue.
multiprocessing.set_start_method("fork", force=True)

auth = None

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -241,27 +237,19 @@ def _prepare_settings():
return (overrides, zmq_info)


def _custom_worker_init(django_init_worker):
def _custom_worker_init(django_init_worker, *args, **kwargs):
"""Wrap the original worker init to also start the manager."""

def _init_worker(*args, **kwargs):
"""Initialize a :class:`multiprocessing.Pool` worker.

Call the Django's ``ParallelTestSuite.init_worker`` and then
also start the manager infrastructure.
"""
result = django_init_worker(*args, **kwargs)
result = django_init_worker(*args, **kwargs)

# Further patch channel names and the like with our current pid,
# so that parallel managers and executors don't clash on the
# same channels and directories.
resolwe_settings.FLOW_MANAGER_SETTINGS[
"REDIS_PREFIX"
] += "-parallel-pid{}".format(os.getpid())
# Further patch channel names and the like with our current pid,
# so that parallel managers and executors don't clash on the
# same channels and directories.
resolwe_settings.FLOW_MANAGER_SETTINGS[
"REDIS_PREFIX"
] += "-parallel-pid{}".format(os.getpid())

return result

return _init_worker
return result


def _run_in_event_loop(coro, *args, **kwargs):
Expand Down Expand Up @@ -361,8 +349,7 @@ def run(self, *args, **kwargs):

class CustomParallelTestSuite(ParallelTestSuite):
"""Standard parallel suite with a custom worker initializer."""

init_worker = _custom_worker_init(ParallelTestSuite.init_worker)
init_worker = partial(_custom_worker_init, django_init_worker=ParallelTestSuite.init_worker)

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import for partial from functools. This will cause a NameError at runtime.

Copilot uses AI. Check for mistakes.
runner_class = CustomRemoteRunner


Expand Down
1 change: 1 addition & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
INSTALLED_APPS = (
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.postgres",
"django.contrib.sessions",
"django.contrib.staticfiles",
"channels",
Expand Down
Loading