Skip to content
Open
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
10 changes: 9 additions & 1 deletion queue_job/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@
from operator import attrgetter
from unittest import TestCase, mock

from odoo.tests.common import SETATTR_SOURCES

from odoo.addons.queue_job.delay import Graph

# pylint: disable=odoo-addons-relative-import
from odoo.addons.queue_job.job import Job

# Register queue_job patcher as a known path to prevent verbose warning
# in tests when methods are patched.
SETATTR_SOURCES["_patch_method"] = tuple(
list(SETATTR_SOURCES.get("_patch_method", [])) + ["/queue_job/models/base.py"],
)


@contextmanager
def trap_jobs():
Expand Down Expand Up @@ -206,7 +214,7 @@ def assert_enqueued_job(self, method, args=None, kwargs=None, properties=None):

if expected_call not in actual_calls:
raise AssertionError(
"Job {} was not enqueued.\n" "Actual enqueued jobs:\n{}".format(
"Job {} was not enqueued.\nActual enqueued jobs:\n{}".format(
self._format_job_call(expected_call),
"\n".join(
f" * {self._format_job_call(call)}" for call in actual_calls
Expand Down
Loading