From 373742031154547cc95dfb8cd7d01fa9537b02a8 Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Wed, 7 May 2025 11:20:22 +0200 Subject: [PATCH] Add -i option --- main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index b032a69..2c8507d 100644 --- a/main.py +++ b/main.py @@ -19,7 +19,7 @@ worktrees = { } -def _run_odoo(worktree_root, test_tags: str) -> bool: +def _run_odoo(worktree_root, test_tags: str, init: str) -> bool: venv_path = f"{worktree_root}/venv-bisect" rmtree(venv_path, ignore_errors=True) subprocess.check_call( @@ -43,7 +43,7 @@ def _run_odoo(worktree_root, test_tags: str) -> bool: env=env, ) process = subprocess.Popen( - ["odoo", "--no-patch", "--drop", "--test-tags", test_tags], + ["odoo", "--no-patch", "--drop", "-i", init, "--test-tags", test_tags], cwd=worktree_root, env=env, stdout=subprocess.PIPE, @@ -114,7 +114,7 @@ def _find_first_failing_commit(batches: list[int], test_failed): raise ValueError("404") -def _bisect(version: str, test_tags: str) -> Optional[dict[Repo, str]]: +def _bisect(version: str, test_tags: str, init: str) -> Optional[dict[Repo, str]]: bundle = bundles[version] worktree_root = worktrees[version] odoo_repository = GitRepository(f"{worktree_root}/odoo") @@ -125,7 +125,7 @@ def _bisect(version: str, test_tags: str) -> Optional[dict[Repo, str]]: commits = _commits_from_batch(batch) odoo_repository.checkout(commits["odoo"]) enterprise_repository.checkout(commits["enterprise"]) - return not _run_odoo(test_tags) + return not _run_odoo(worktree_root, test_tags, init) suspect = _find_first_failing_commit(batches, test_failed) if suspect: @@ -159,8 +159,9 @@ def _bisect(version: str, test_tags: str) -> Optional[dict[Repo, str]]: @click.command() @click.option("--version", default="17.0", type=click.Choice(bundles.keys())) @click.option("--test-tags") -def main(version, test_tags): - _bisect(version, test_tags) +@click.option("-i", "--init") +def main(version, test_tags, init): + _bisect(version, test_tags, init) if __name__ == "__main__":