Skip to content

Commit cf43a35

Browse files
committed
test(cli): read v2 Analysis envelope (symbol_table/call_graph under application)
1 parent 5a13f31 commit cf43a35

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

test/test_cli.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ def test_cli_call_symbol_table_with_json(cli_runner, whole_applications__xarray)
4343
json_obj = json.loads(Path(output_dir).joinpath("analysis.json").read_text())
4444
assert json_obj is not None, "JSON output should not be None"
4545
assert isinstance(json_obj, dict), "JSON output should be a dictionary"
46-
assert "symbol_table" in json_obj.keys(), "Symbol table should be present in the output"
47-
assert len(json_obj["symbol_table"]) > 0, "Symbol table should not be empty"
46+
assert json_obj.get("schema_version") == "2.0.0"
47+
app = json_obj["application"]
48+
assert "symbol_table" in app
49+
assert len(app["symbol_table"]) > 0
4850

4951

5052
def test_no_venv_skips_virtualenv(
@@ -102,7 +104,7 @@ def test_single_file(cli_runner, single_functionalities__stuff_nested_in_functio
102104
json_obj = json.loads(Path(output_dir).joinpath("analysis.json").read_text())
103105
assert json_obj is not None, "JSON output should not be None"
104106
assert isinstance(json_obj, dict), "JSON output should be a dictionary"
105-
assert "symbol_table" in json_obj.keys(), "Symbol table should be present in the output"
107+
assert "symbol_table" in json_obj["application"], "Symbol table should be present in the output"
106108

107109

108110
# ---------------------------------------------------------------------------
@@ -132,7 +134,10 @@ def _run_analysis(cli_runner, fixture_dir, analysis_level=1, file_name=None, ext
132134
assert result.exit_code == 0, f"CLI failed (level {analysis_level}): {result.output}"
133135
out = fixture_dir.joinpath(".output", "analysis.json")
134136
assert out.exists()
135-
return json.loads(out.read_text())
137+
payload = json.loads(out.read_text())
138+
assert payload.get("schema_version") == "2.0.0", "output must be the v2 Analysis envelope"
139+
assert "application" in payload, "envelope must carry application"
140+
return payload["application"]
136141

137142

138143
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)