From 63ad5f45fbb782d1298a5fcd06815b710bb501dc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:44:11 +0000 Subject: [PATCH 1/2] Initial plan From 11d7bb9b8a3b2c67daf6d9fc5a2af2661f1fa694 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:53:28 +0000 Subject: [PATCH 2/2] Add test_generate_vqa.py for VQA generation testing Co-authored-by: ChenZiHong-Gavin <58508660+ChenZiHong-Gavin@users.noreply.github.com> --- tests/e2e_tests/test_generate_vqa.py | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/e2e_tests/test_generate_vqa.py diff --git a/tests/e2e_tests/test_generate_vqa.py b/tests/e2e_tests/test_generate_vqa.py new file mode 100644 index 00000000..5a285deb --- /dev/null +++ b/tests/e2e_tests/test_generate_vqa.py @@ -0,0 +1,50 @@ +import json +import os +import subprocess +from pathlib import Path + + +def test_generate_vqa(tmp_path: Path): + repo_root = Path(__file__).resolve().parents[2] + os.chdir(repo_root) + + config_path = repo_root / "graphgen" / "configs" / "vqa_config.yaml" + output_dir = tmp_path / "output" + output_dir.mkdir(parents=True, exist_ok=True) + + result = subprocess.run( + [ + "python", + "-m", + "graphgen.generate", + "--config_file", + str(config_path), + "--output_dir", + str(output_dir), + ], + capture_output=True, + text=True, + check=False, + ) + assert result.returncode == 0, f"Script failed with error: {result.stderr}" + + data_root = output_dir / "data" / "graphgen" + assert data_root.exists(), f"{data_root} does not exist" + run_folders = sorted(data_root.iterdir(), key=lambda p: p.name, reverse=True) + assert run_folders, f"No run folders found in {data_root}" + run_folder = run_folders[0] + + config_saved = run_folder / "config.yaml" + assert config_saved.exists(), f"{config_saved} not found" + + json_files = list(run_folder.glob("*.json")) + assert json_files, f"No JSON output found in {run_folder}" + + log_files = list(run_folder.glob("*.log")) + assert log_files, "No log file generated" + + with open(json_files[0], "r", encoding="utf-8") as f: + data = json.load(f) + assert ( + isinstance(data, list) and len(data) > 0 + ), "JSON output is empty or not a list"