Add -i option

This commit is contained in:
Hubert Van De Walle 2025-05-07 11:20:22 +02:00
parent 5b92d2a8a5
commit 3737420311

13
main.py
View File

@ -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__":