运行测试用例
python odoo-bin -d <database_name> -i my_module --test-tags=my_module:TestOptimalRouteSelection.test_route_profit_calculation --stop-after-init
-d <database_name>:指定 Odoo 使用的数据库名称。
-i my_module:加载和初始化要测试的模块。
–test-tags=my_module:TestOptimalRouteSelection.test_route_profit_calculation:指定要测试的单个测试用例。
my_module 是模块名称。
TestOptimalRouteSelection 是测试类名称。
test_route_profit_calculation 是测试方法名称。
–stop-after-init:在测试完成后停止 Odoo 实例,便于快速测试
例子:
python odoo-bin -d ma25223 -i ebde_picking_notes --test-tags=ebde_picking_notes:TestPickingOrder.test_picking_order_add_notes
test_picking_notes.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import tagged, Formfrom odoo.tests.common import TransactionCase@tagged('post_install', '-at_install',