There's more...

The main drawback of this way of running tests is that you have to run all the tests for a given addon module, even if you know that they all pass but the one you are trying to fix, and you also have to update the addon (which can be a costly operation in itself).

There is a way around this. If you want to run the tests in my_module/tests/test_library.py, you can use the following command:

$ odoo-bin -c project.cfg --log-level=error --stop-after-init 
--test-file my_module/tests/test_library.py

This will run only the tests defined in that file. Since it skips updating the module, it will not work if you have changed the model structure by adding new fields or modified the data files of the addon since the last time the module was updated.

One final note about tests:
Always be suspicious if your tests are not in error on the first run. There are good chances that this means you made a mistake. A typical goof is to forget to import the test file in tests/__init__.py. It is always a good idea when tests are passing on the first run to force a failure, for instance, adding assert False on the first line of a method and to run them again.
..................Content has been hidden....................

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