How to do it...

Add a tagged() decorator (like the following) on the test class to run it after the installation of all modules:

from odoo.tests.common import TransactionCase, tagged

@tagged('-at_install', 'post_install')
class TestBookState(TransactionCase):
...

After that, run the test case as follows, just like before:

./odoo-bin -c server.conf -i my_library --test-enable

Now check the server log. This time, you will see our test case log after the following logs, meaning that our test cases are run after all of the modules are installed, as follows:

... INFO test odoo.modules.loading: 10 modules loaded in 21.43s, 346 queries 
... INFO test odoo.modules.loading: Modules loaded.
... INFO test odoo.service.server: Starting post tests

In these logs, the first line shows that 10 modules are loaded. The second line shows that all requested modules and their dependencies were installed successfully, and the third line shows that it will start running the test cases that are tagged as post_install.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset