Skip to content
Snippets Groups Projects
Commit 311514c74d07 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:sparkles: display coverage information when running tests with docker_dev_start

parent 70b9968ed5db
No related branches found
No related tags found
1 merge request!1update_duplicate_sources: Rely on clone URL
...@@ -466,7 +466,12 @@ ...@@ -466,7 +466,12 @@
options.append("--publish") options.append("--publish")
options.append("8069:8069") options.append("8069:8069")
binds = [] binds = []
arg = ["start"] # TODO handle other version of odoo (base image need to be changed too)
coverage = (nmspc.test or nmspc.test_default) and odoo_type in (
"odoo11",
"odoo13",
)
arg = ["coverage-start" if coverage else "start"]
if db_password: if db_password:
arg.append("--db_password %s" % db_password) arg.append("--db_password %s" % db_password)
if nmspc.update: if nmspc.update:
...@@ -790,5 +795,6 @@ ...@@ -790,5 +795,6 @@
return 15 return 15
# volume magic # volume magic
target_module_directory = "/mnt/addons"
for module in modules: for module in modules:
binds.append( binds.append(
...@@ -793,5 +799,5 @@ ...@@ -793,5 +799,5 @@
for module in modules: for module in modules:
binds.append( binds.append(
"%s:/mnt/addons/%s" "%s:%s/%s"
% ( % (
os.path.realpath(os.path.join(project_path, module)), os.path.realpath(os.path.join(project_path, module)),
...@@ -796,5 +802,6 @@ ...@@ -796,5 +802,6 @@
% ( % (
os.path.realpath(os.path.join(project_path, module)), os.path.realpath(os.path.join(project_path, module)),
target_module_directory,
os.path.basename(module), os.path.basename(module),
) )
) )
...@@ -798,7 +805,7 @@ ...@@ -798,7 +805,7 @@
os.path.basename(module), os.path.basename(module),
) )
) )
all_addons_dir = ["/mnt/addons"] all_addons_dir = [target_module_directory]
if odoo_type in ("odoo7", "odoo8"): if odoo_type in ("odoo7", "odoo8"):
all_addons_dir.append("/opt/odoo/sources/odoo/addons") all_addons_dir.append("/opt/odoo/sources/odoo/addons")
if all_addons_dir: if all_addons_dir:
...@@ -857,6 +864,21 @@ ...@@ -857,6 +864,21 @@
options.append("--volume") options.append("--volume")
options.append(bind) options.append(bind)
if coverage:
if nmspc.test_default:
source_files = target_module_directory
else:
# TODO when testing base modules, coverage will not be shown
source_files = ",".join(
[
"{}/{}".format(target_module_directory, module)
for module in nmspc.test.split(",")
]
)
options.extend(
("--env", "COVERAGE_RUN_OPTIONS=--source=" + source_files)
)
cmd = ["docker", "run"] cmd = ["docker", "run"]
cmd.extend(options) cmd.extend(options)
cmd.append(image) cmd.append(image)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment