| |
@@ -26,7 +26,7 @@
|
| |
from sqlalchemy.exc import SQLAlchemyError
|
| |
from sqlalchemy.orm import (
|
| |
backref,
|
| |
- relation,
|
| |
+ relationship as relation,
|
| |
scoped_session,
|
| |
sessionmaker,
|
| |
validates,
|
| |
@@ -1039,9 +1039,11 @@
|
| |
"full_url": self.full_url,
|
| |
"description": self.description,
|
| |
"namespace": self.namespace,
|
| |
- "parent": self.parent.to_json(public=public, api=api)
|
| |
- if self.parent
|
| |
- else None,
|
| |
+ "parent": (
|
| |
+ self.parent.to_json(public=public, api=api)
|
| |
+ if self.parent
|
| |
+ else None
|
| |
+ ),
|
| |
"date_created": arrow_ts(self.date_created),
|
| |
"date_modified": arrow_ts(self.date_modified),
|
| |
"user": self.user.to_json(public=public),
|
| |
@@ -1507,20 +1509,22 @@
|
| |
"tags": self.tags_text,
|
| |
"depends": ["%s" % item for item in self.depending_text],
|
| |
"blocks": ["%s" % item for item in self.blocking_text],
|
| |
- "assignee": self.assignee.to_json(public=public)
|
| |
- if self.assignee
|
| |
- else None,
|
| |
+ "assignee": (
|
| |
+ self.assignee.to_json(public=public) if self.assignee else None
|
| |
+ ),
|
| |
"priority": self.priority,
|
| |
"milestone": self.milestone,
|
| |
"custom_fields": custom_fields,
|
| |
- "closed_by": self.closed_by.to_json(public=public)
|
| |
- if self.closed_by
|
| |
- else None,
|
| |
- "related_prs": [
|
| |
- {"id": pr.id, "title": pr.title} for pr in self.related_prs
|
| |
- ]
|
| |
- if self.related_prs
|
| |
- else [],
|
| |
+ "closed_by": (
|
| |
+ self.closed_by.to_json(public=public)
|
| |
+ if self.closed_by
|
| |
+ else None
|
| |
+ ),
|
| |
+ "related_prs": (
|
| |
+ [{"id": pr.id, "title": pr.title} for pr in self.related_prs]
|
| |
+ if self.related_prs
|
| |
+ else []
|
| |
+ ),
|
| |
"full_url": self.full_url,
|
| |
}
|
| |
|
| |
@@ -1683,9 +1687,9 @@
|
| |
"date_created": arrow_ts(self.date_created),
|
| |
"user": self.user.to_json(public=public),
|
| |
"edited_on": arrow_ts(self.edited_on) if self.edited_on else None,
|
| |
- "editor": self.editor.to_json(public=public)
|
| |
- if self.editor_id
|
| |
- else None,
|
| |
+ "editor": (
|
| |
+ self.editor.to_json(public=public) if self.editor_id else None
|
| |
+ ),
|
| |
"notification": self.notification,
|
| |
"reactions": self.reactions,
|
| |
}
|
| |
@@ -2212,24 +2216,28 @@
|
| |
"branch": self.branch,
|
| |
"project": self.project.to_json(public=public, api=api),
|
| |
"branch_from": self.branch_from,
|
| |
- "repo_from": self.project_from.to_json(public=public, api=api)
|
| |
- if self.project_from
|
| |
- else None,
|
| |
+ "repo_from": (
|
| |
+ self.project_from.to_json(public=public, api=api)
|
| |
+ if self.project_from
|
| |
+ else None
|
| |
+ ),
|
| |
"remote_git": self.remote_git,
|
| |
"date_created": arrow_ts(self.date_created),
|
| |
"updated_on": arrow_ts(self.updated_on),
|
| |
"last_updated": arrow_ts(self.last_updated),
|
| |
"closed_at": arrow_ts(self.closed_at) if self.closed_at else None,
|
| |
"user": self.user.to_json(public=public),
|
| |
- "assignee": self.assignee.to_json(public=public)
|
| |
- if self.assignee
|
| |
- else None,
|
| |
+ "assignee": (
|
| |
+ self.assignee.to_json(public=public) if self.assignee else None
|
| |
+ ),
|
| |
"status": self.status,
|
| |
"commit_start": self.commit_start,
|
| |
"commit_stop": self.commit_stop,
|
| |
- "closed_by": self.closed_by.to_json(public=public)
|
| |
- if self.closed_by
|
| |
- else None,
|
| |
+ "closed_by": (
|
| |
+ self.closed_by.to_json(public=public)
|
| |
+ if self.closed_by
|
| |
+ else None
|
| |
+ ),
|
| |
"initial_comment": self.initial_comment,
|
| |
"cached_merge_status": self.merge_status or "unknown",
|
| |
"threshold_reached": self.threshold_reached,
|
| |
@@ -2358,9 +2366,9 @@
|
| |
"date_created": arrow_ts(self.date_created),
|
| |
"user": self.user.to_json(public=public),
|
| |
"edited_on": arrow_ts(self.edited_on) if self.edited_on else None,
|
| |
- "editor": self.editor.to_json(public=public)
|
| |
- if self.editor_id
|
| |
- else None,
|
| |
+ "editor": (
|
| |
+ self.editor.to_json(public=public) if self.editor_id else None
|
| |
+ ),
|
| |
"notification": self.notification,
|
| |
"reactions": self.reactions,
|
| |
}
|
| |
Work in Progress PR (not ready to be merged) to bump test container to F40.
This includes raising version pinning in pip and align it with the package version shipped in F40 as rpm. Means it addresses a couple of tech debts as well.
I was able to bring the failed tests down to one:
FAILED tests/test_pagure_flask_dump_load_ticket.py::PagureFlaskDumpLoadTicketTests::test_dumping_reloading_ticket - Exception: Unable to find object
But even after spending hours, I didn't find a way to fix it. For me it looks like an issue how we test and that the actual pagure code is fine.
This
update_ticket_from_git
call (https://pagure.io/pagure/blob/master/f/tests/test_pagure_flask_dump_load_ticket.py#_194) fails because it the database return isNone
(https://pagure.io/pagure/blob/master/f/pagure/lib/tasks.py#_277) and not the latest ticket entry (https://pagure.io/pagure/blob/master/f/pagure/lib/query.py#_3507).The thing is, when I throw an exception before https://pagure.io/pagure/blob/master/f/pagure/lib/tasks.py#_285 like this:
Then
obj
is notNone
and contains the expected database result. If I don't throw the exception, then theif obj is None:
hits.That sounds like some sort of weird concurrency, async whatever issue to me. In https://pagure.io/pagure/blob/master/f/tests/test_pagure_flask_dump_load_ticket.py#_172 we throw away the current db session and recreate everything again. But celery seem to continue to use the global one from before because of the task decorator we add: https://pagure.io/pagure/blob/master/f/pagure/lib/tasks_utils.py#_20
But why there is a result when I throw and exception myself but no of I let it just running, no idea yet.
The unit, or better integration tests, starting celery tasks in always eager mode (https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-always-eager). Another confusing thing because we run a redis instance inside the test container and configure the communication through unix sockets. So for probably historical reasons there are a couple of weird things going on regarding testing our celery tasks in my opinion.
So currently I don't have a idea how to further troubleshoot and address the
Unable to find object
problem. It also becomes a time problem, I spend way too much of my non existing free time on it already :-/ I pushed the code I have so far and leave the PR open as WIP in case someone else has some ideas and can help out here.