summaryrefslogtreecommitdiff
path: root/addons/website_forum/tests
diff options
context:
space:
mode:
authorChristophe Monniez <moc@odoo.com>2017-08-21 08:36:35 +0200
committerChristophe Monniez <moc@odoo.com>2018-01-18 13:20:37 +0100
commitb356b190338e3ee032b9e3a7f670f76468965006 (patch)
treef32b334a7a7a467646e778d9f93a70a262f5b626 /addons/website_forum/tests
parent079e1a0c312ea6ed66ed42676b25b6ac22db2b58 (diff)
[IMP] tests: Add the possibility to tag tests
Purpose: When running tests, all the tests for the installed/updated files are done. This commit adds a 'tagged' decorator that can be used to tag tests. Combined with a new 'test-tags' CLI option, it adds the ability to filter which tests are executed. For example, @tagged('slow') will add a tag 'slow' to the test. The CLI option 'test-tags="slow"' will only run tests tagged 'slow'. One can use prefixes to select cases with tags. '+' or no prefix means that the tests tagged with this tag are selected for execution. '-' prefix will exclude the tests tagged with this tag. Exclusion takes precedence over inclusion. Also, by default, all Odoo tests cases are tagged 'standard' and with the technical name of the module. This means that when selecting tests with the 'test-tags' parameter, if '-standard' is not specified, all tests tags are going to be executed. When tagging tests, one can remove such automatic tag by prefixing the tag name with '-'. E.g. @tagged('-standard') will remove the standard tag from the test. Another example, if one wants to test the 'sale' module alone, even without adding any 'tagged' decorator thos tests can be selected like that: --test-tags="sale" Tests are selected or deselected using a TagsSelector. When instanciated, a string is passed with comma separated tests selectors like '+slow,-standard'. When the 'check' method is called with a test as argument, it returns True or False if the test has to be executed or not.
Diffstat (limited to 'addons/website_forum/tests')
-rw-r--r--addons/website_forum/tests/test_forum_process.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/addons/website_forum/tests/test_forum_process.py b/addons/website_forum/tests/test_forum_process.py
index 2f23ebae67e..52f49be3133 100644
--- a/addons/website_forum/tests/test_forum_process.py
+++ b/addons/website_forum/tests/test_forum_process.py
@@ -2,11 +2,9 @@
import odoo.tests
+@odoo.tests.common.tagged('post_install', '-at_install')
class TestUi(odoo.tests.HttpCase):
- post_install = True
- at_install = False
-
def test_01_admin_forum_tour(self):
self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('question')", "odoo.__DEBUG__.services['web_tour.tour'].tours.question.ready", login="admin")