+1 vote
20 views

Tests in installed module didn't run.I installed a module module_a from website, then I create the tests files in this module. The tests didn't run when I run python3 odoo-bin -c odoo.conf -d odoo12 --test-enable -u module_a.(Windows)here is the test file. It's imported by the tests__ini__.py

# -*- coding: utf-8 -*-
from odoo.tests.common import TransactionCase
from odoo.tests import tagged

class TestBook(TransactionCase):
    def test_create(self):
        "Create a simple Book Order"
        print("testtest")
        Todo = self.env["book.order"]
        task = Todo.create({"name": "test_order"})
        self.assertEqual(task.state, "draft")

Could you please give me some help?

in App by (10.2k points) | 20 views

1 Answer

0 votes

You have to add tag post_install for the test to run when upgrading.

@tagged('post_install')
class TestBook(TransactionCase):
by (8.6k points)
192 questions
163 answers
32 comments
38,848 users