Skip to content

Commit 234b7ee

Browse files
committed
Fix tests broken by merge and level-1 Jedi restoration
- Remove --no-codeql from test_no_venv_skips_virtualenv (flag no longer exists) - Update level-1 CLI tests to assert call_graph non-empty (Jedi edges now always produced at level 1; previous assertion was written before that fix) - Replace 'codeql' provenance literal in sample_graph_app.py with 'pycg' (PyCallEdge schema only allows jedi/pycg/joern after CodeQL removal) Signed-off-by: Saurabh Sinha <sinha108@gmail.com>
1 parent 0fd09b4 commit 234b7ee

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

test/sample_graph_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def make_sample_app() -> PyApplication:
143143
source="src.service.helper",
144144
target="requests.get",
145145
weight=2,
146-
provenance=["jedi", "codeql"],
146+
provenance=["jedi", "pycg"],
147147
),
148148
]
149149

test/test_cli.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_no_venv_skips_virtualenv(
5050
"--input", str(single_functionalities__stuff_nested_in_functions),
5151
"--output", str(out),
5252
"--cache-dir", str(cache),
53-
"--no-venv", "--no-codeql", "--no-ray",
53+
"--no-venv", "--no-ray",
5454
],
5555
env={"NO_COLOR": "1", "TERM": "dumb"},
5656
)
@@ -131,12 +131,12 @@ def _run_analysis(cli_runner, fixture_dir, analysis_level=1, file_name=None, ext
131131
# ---------------------------------------------------------------------------
132132

133133
def test_decorators_hof_level1(cli_runner, single_functionalities__decorators_and_hof):
134-
"""Level 1 on decorators_and_hof: symbol table populated, call_graph empty."""
134+
"""Level 1 on decorators_and_hof: symbol table populated, call_graph has Jedi edges."""
135135
main_py = single_functionalities__decorators_and_hof / "main.py"
136136
obj = _run_analysis(cli_runner, single_functionalities__decorators_and_hof,
137137
analysis_level=1, file_name=main_py)
138138
assert len(obj["symbol_table"]) > 0
139-
assert obj["call_graph"] == [], "Level 1 must not populate call_graph"
139+
assert len(obj["call_graph"]) > 0, "Level 1 must populate call_graph with Jedi edges"
140140
sigs = {c["signature"] for mod in obj["symbol_table"].values()
141141
for c in _all_callables(mod)}
142142
assert any("main" in s for s in sigs), "Expected 'main' callable in symbol table"
@@ -176,7 +176,7 @@ def test_class_hierarchy_level1(cli_runner, single_functionalities__class_hierar
176176
main_py = single_functionalities__class_hierarchy / "main.py"
177177
obj = _run_analysis(cli_runner, single_functionalities__class_hierarchy,
178178
analysis_level=1, file_name=main_py)
179-
assert obj["call_graph"] == [], "Level 1 must not populate call_graph"
179+
assert len(obj["call_graph"]) > 0, "Level 1 must populate call_graph with Jedi edges"
180180
classes = {cls for mod in obj["symbol_table"].values()
181181
for cls in mod.get("classes", {}).keys()}
182182
assert any("Animal" in c for c in classes)
@@ -218,7 +218,7 @@ def test_async_patterns_level1(cli_runner, single_functionalities__async_pattern
218218
main_py = single_functionalities__async_patterns / "main.py"
219219
obj = _run_analysis(cli_runner, single_functionalities__async_patterns,
220220
analysis_level=1, file_name=main_py)
221-
assert obj["call_graph"] == [], "Level 1 must not populate call_graph"
221+
assert len(obj["call_graph"]) > 0, "Level 1 must populate call_graph with Jedi edges"
222222
sigs = {c["signature"] for mod in obj["symbol_table"].values()
223223
for c in _all_callables(mod)}
224224
assert any("fetch_data" in s for s in sigs)
@@ -264,7 +264,7 @@ def test_flask_level1(cli_runner, whole_applications__flask):
264264
"""Level 1 on Flask 3.0.3: symbol table populated."""
265265
obj = _run_analysis(cli_runner, whole_applications__flask, analysis_level=1)
266266
assert len(obj["symbol_table"]) > 0
267-
assert obj["call_graph"] == [], "Level 1 must not populate call_graph"
267+
assert len(obj["call_graph"]) > 0, "Level 1 must populate call_graph with Jedi edges"
268268
assert any("flask" in mod_path.lower() for mod_path in obj["symbol_table"]), \
269269
"Flask modules should be in symbol table"
270270

@@ -288,7 +288,7 @@ def test_requests_level1(cli_runner, whole_applications__requests):
288288
"""Level 1 on requests 2.31.0: symbol table populated."""
289289
obj = _run_analysis(cli_runner, whole_applications__requests, analysis_level=1)
290290
assert len(obj["symbol_table"]) > 0
291-
assert obj["call_graph"] == [], "Level 1 must not populate call_graph"
291+
assert len(obj["call_graph"]) > 0, "Level 1 must populate call_graph with Jedi edges"
292292

293293

294294
def test_requests_level2(cli_runner, whole_applications__requests):

0 commit comments

Comments
 (0)