From cf19262827e94b5a607e8e9503a133e753f08db2 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 26 Jan 2022 16:39:42 -0500 Subject: [PATCH] [ADD] script: db drop only test --- Makefile | 4 ++++ script/database/db_drop_all.py | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/Makefile b/Makefile index 752ce25..40b88d0 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/script/database/db_drop_all.py b/script/database/db_drop_all.py index ad6b9be..b9987d0 100755 --- a/script/database/db_drop_all.py +++ b/script/database/db_drop_all.py @@ -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}"