[ADD] script: db drop only test

This commit is contained in:
Mathieu Benoit 2022-01-26 16:39:42 -05:00
parent 34535a2b7a
commit cf19262827
2 changed files with 15 additions and 0 deletions

View file

@ -117,6 +117,10 @@ db_drop_db_template:
db_drop_all:
./script/database/db_drop_all.py
.PHONY: db_drop_test
db_drop_test:
./script/database/db_drop_all.py --test_only
.PHONY: db_clean_cache
db_clean_cache:
./script/db_restore.py --clean_cache

View file

@ -22,6 +22,11 @@ def get_config():
epilog="""\
""",
)
parser.add_argument(
"--test_only",
help="test and test_* and other by system test.",
action="store_true",
)
args = parser.parse_args()
return args
@ -32,6 +37,12 @@ def main():
out_db = execute_shell("./.venv/bin/python3 ./odoo/odoo-bin db --list")
lst_db = out_db.split("\n")
for db_name in lst_db:
if config.test_only and not (
db_name in ("test",)
or db_name.startswith("test_")
or db_name.startswith("new_project_")
):
continue
execute_shell(
"./.venv/bin/python3 ./odoo/odoo-bin db --drop --database"
f" {db_name}"