MCPcopy Index your code
hub / github.com/google/adk-python / get_test_files

Function get_test_files

src/google/adk/cli/agent_test_runner.py:55–95  ·  view source on GitHub ↗

Returns list of (agent_dir, test_file_path) recursively.

(
    target_folder: str | None = None,
)

Source from the content-addressed store, hash-verified

53
54# Read target folder from environment
55def get_test_files(
56 target_folder: str | None = None,
57) -> list[pytest.ParameterSet]:
58 """Returns list of (agent_dir, test_file_path) recursively."""
59 folder = target_folder or os.environ.get("ADK_TEST_FOLDER")
60 if not folder:
61 return []
62 target_dir = Path(folder)
63 if not target_dir.exists():
64 return []
65
66 samples_dir = (
67 Path(__file__).parent.parent.parent.parent.parent
68 / "contributing"
69 / "samples"
70 )
71
72 results = []
73 for test_file in target_dir.rglob("tests/*.json"):
74 agent_dir = test_file.parent.parent
75 # Verify it looks like an agent directory
76 if (
77 (agent_dir / "agent.py").exists()
78 or (agent_dir / "__init__.py").exists()
79 or (agent_dir / "root_agent.yaml").exists()
80 ):
81 try:
82 rel_dir = agent_dir.relative_to(samples_dir)
83 test_id = f"{rel_dir}/{test_file.name}"
84 except ValueError:
85 test_id = f"{agent_dir.name}/{test_file.name}"
86
87 if test_file.stem.endswith("_xfail"):
88 results.append(
89 pytest.param(
90 agent_dir, test_file, id=test_id, marks=pytest.mark.xfail
91 )
92 )
93 else:
94 results.append(pytest.param(agent_dir, test_file, id=test_id))
95 return results
96
97
98class MockModel(BaseLlm):

Callers 1

rebuild_testsFunction · 0.70

Calls 3

getMethod · 0.45
existsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected