-
-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from simahawk/12-ease-tests
[12.0] queue_job: ease testing
- Loading branch information
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,34 @@ | ||
To use this module, you need to: | ||
|
||
#. Go to ``Job Queue`` menu | ||
|
||
Developers | ||
~~~~~~~~~~ | ||
|
||
**Bypass jobs on running Odoo** | ||
|
||
When you are developing (ie: connector modules) you might want | ||
to bypass the queue job and run your code immediately. | ||
|
||
To do so you can set `TEST_QUEUE_JOB_NO_DELAY=1` in your enviroment. | ||
|
||
**Bypass jobs in tests** | ||
|
||
When writing tests on job-related methods is always tricky to deal with | ||
delayed recordsets. To make your testing life easier | ||
you can set `test_queue_job_no_delay=True` in the context. | ||
|
||
Tip: you can do this at test case level like this | ||
|
||
.. code-block:: python | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.env = cls.env(context=dict( | ||
cls.env.context, | ||
test_queue_job_no_delay=True, # no jobs thanks | ||
)) | ||
Then all your tests execute the job methods synchronously | ||
without delaying any jobs. |