Skip to content

Commit 75f9e13

Browse files
committed
Run pre-commit run -a
1 parent c193b02 commit 75f9e13

8 files changed

Lines changed: 27 additions & 15 deletions

File tree

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ exclude: |
33
# NOT INSTALLABLE ADDONS
44
^base_export_async/|
55
^base_import_async/|
6-
^queue_job/|
76
^queue_job_cron/|
87
^queue_job_subscribe/|
98
^test_base_import_async/|
10-
^test_queue_job/|
119
# END NOT INSTALLABLE ADDONS
1210
# Files and folders generated by bots, to avoid loops
1311
^setup/|/static/description/index\.html$|
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../queue_job

setup/queue_job/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../test_queue_job

setup/test_queue_job/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

test_queue_job/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
"name": "Queue Job Tests",
6-
"version": "14.0.1.3.0",
6+
"version": "15.0.1.0.0",
77
"author": "Camptocamp,Odoo Community Association (OCA)",
88
"license": "LGPL-3",
99
"category": "Generic Modules",

test_queue_job/tests/test_job.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
class TestJobsOnTestingMethod(JobCommonCase):
32-
""" Test Job """
32+
"""Test Job"""
3333

3434
def test_new_job(self):
3535
"""
@@ -39,22 +39,22 @@ def test_new_job(self):
3939
self.assertEqual(test_job.func.__func__, self.method.__func__)
4040

4141
def test_eta(self):
42-
""" When an `eta` is datetime, it uses it """
42+
"""When an `eta` is datetime, it uses it"""
4343
now = datetime.now()
4444
method = self.env["res.users"].mapped
4545
job_a = Job(method, eta=now)
4646
self.assertEqual(job_a.eta, now)
4747

4848
def test_eta_integer(self):
49-
""" When an `eta` is an integer, it adds n seconds up to now """
49+
"""When an `eta` is an integer, it adds n seconds up to now"""
5050
datetime_path = "odoo.addons.queue_job.job.datetime"
5151
with mock.patch(datetime_path, autospec=True) as mock_datetime:
5252
mock_datetime.now.return_value = datetime(2015, 3, 15, 16, 41, 0)
5353
job_a = Job(self.method, eta=60)
5454
self.assertEqual(job_a.eta, datetime(2015, 3, 15, 16, 42, 0))
5555

5656
def test_eta_timedelta(self):
57-
""" When an `eta` is a timedelta, it adds it up to now """
57+
"""When an `eta` is a timedelta, it adds it up to now"""
5858
datetime_path = "odoo.addons.queue_job.job.datetime"
5959
with mock.patch(datetime_path, autospec=True) as mock_datetime:
6060
mock_datetime.now.return_value = datetime(2015, 3, 15, 16, 41, 0)
@@ -324,7 +324,7 @@ def test_job_identity_key_func_exact(self):
324324

325325

326326
class TestJobs(JobCommonCase):
327-
""" Test jobs on other methods or with different job configuration """
327+
"""Test jobs on other methods or with different job configuration"""
328328

329329
def test_description(self):
330330
"""If no description is given to the job, it
@@ -343,7 +343,7 @@ def test_description(self):
343343
self.assertEqual(job_a.description, description)
344344

345345
def test_retry_pattern(self):
346-
""" When we specify a retry pattern, the eta must follow it"""
346+
"""When we specify a retry pattern, the eta must follow it"""
347347
datetime_path = "odoo.addons.queue_job.job.datetime"
348348
method = self.env["test.queue.job"].job_with_retry_pattern
349349
with mock.patch(datetime_path, autospec=True) as mock_datetime:
@@ -371,7 +371,7 @@ def test_retry_pattern(self):
371371
self.assertEqual(test_job.eta, datetime(2015, 6, 1, 15, 15, 0))
372372

373373
def test_retry_pattern_no_zero(self):
374-
""" When we specify a retry pattern without 0, uses RETRY_INTERVAL"""
374+
"""When we specify a retry pattern without 0, uses RETRY_INTERVAL"""
375375
method = self.env["test.queue.job"].job_with_retry_pattern__no_zero
376376
test_job = Job(method, max_retries=0)
377377
test_job.retry += 1
@@ -400,7 +400,7 @@ def test_job_delay_model_method_multi(self):
400400
self.assertEqual(["test1", "test2"], job_instance.perform())
401401

402402
def test_job_identity_key_no_duplicate(self):
403-
""" If a job with same identity key in queue do not add a new one """
403+
"""If a job with same identity key in queue do not add a new one"""
404404
id_key = "e294e8444453b09d59bdb6efbfec1323"
405405
rec1 = self.env["test.queue.job"].create({"name": "test1"})
406406
job_1 = rec1.with_delay(identity_key=id_key).mapped("name")
@@ -410,7 +410,7 @@ def test_job_identity_key_no_duplicate(self):
410410
self.assertEqual(job_2.uuid, job_1.uuid)
411411

412412
def test_job_with_mutable_arguments(self):
413-
""" Job with mutable arguments do not mutate on perform() """
413+
"""Job with mutable arguments do not mutate on perform()"""
414414
delayable = self.env["test.queue.job"].with_delay()
415415
job_instance = delayable.job_alter_mutable([1], mutable_kwarg={"a": 1})
416416
self.assertTrue(job_instance)
@@ -531,7 +531,7 @@ def test_job_change_user_id(self):
531531

532532

533533
class TestJobStorageMultiCompany(common.TransactionCase):
534-
""" Test storage of jobs """
534+
"""Test storage of jobs"""
535535

536536
def setUp(self):
537537
super(TestJobStorageMultiCompany, self).setUp()

test_queue_job/tests/test_related_actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class TestRelatedAction(common.SavepointCase):
9-
""" Test Related Actions """
9+
"""Test Related Actions"""
1010

1111
@classmethod
1212
def setUpClass(cls):
@@ -16,7 +16,7 @@ def setUpClass(cls):
1616
cls.records = cls.record + cls.model.create({})
1717

1818
def test_attributes(self):
19-
""" Job with related action check if action returns correctly """
19+
"""Job with related action check if action returns correctly"""
2020
job_ = self.record.with_delay().testing_related_action__kwargs()
2121
act_job, act_kwargs = job_.related_action()
2222
self.assertEqual(act_job, job_.db_record())

0 commit comments

Comments
 (0)