Skip to content

Official Codebase of 3DCodeVerse

Python

tests: cost, gallery, flywheel, reference, languages — delete duplicates and asserts that measure nothing

gaoypengddade05bc8df
diff --git a/harness/tests/cost/test_cli.py b/harness/tests/cost/test_cli.py
index c4262858..4ab509e3 100644
--- a/harness/tests/cost/test_cli.py
+++ b/harness/tests/cost/test_cli.py
@@ -18,6 +18,8 @@ def test_cost_show(fake_run: Path, tmp_path: Path):
assert r.exit_code == 0, r.output
assert "per run" in r.stdout and "passing" not in r.stdout and "judge" in r.stdout
assert out.is_file() and "## Per stage" in out.read_text()
+ r = runner.invoke(app, ["cost", "show", str(fake_run), "--no-per-run"])
+ assert r.exit_code == 0 and "| fake_run | static_object |" not in r.stdout # the per-run table
def test_cost_show_recheck_reports_drift(fake_run: Path):
@@ -113,7 +115,3 @@ def test_cost_prices_flags_stale_and_approximate_rows():
r = runner.invoke(app, ["cost", "prices", "--days", "-1"])
assert r.exit_code == 0 and "stale>-1d" in r.stdout # nothing is younger than -1 days
-
-def test_cost_show_still_works_the_long_way(fake_run: Path):
- r = runner.invoke(app, ["cost", "show", str(fake_run), "--no-per-run"])
- assert r.exit_code == 0
diff --git a/harness/tests/cost/test_instrument.py b/harness/tests/cost/test_instrument.py
index 2e69cac7..70402d61 100644
--- a/harness/tests/cost/test_instrument.py
+++ b/harness/tests/cost/test_instrument.py
@@ -129,12 +129,6 @@ def test_get_coding_agent_hands_out_a_metered_agent(monkeypatch: pytest.MonkeyPa
assert isinstance(registry.get_coding_agent("gemini-cli:m"), MeteredAgent)
-def test_run_ledger_writes_the_one_telemetry_file(tmp_path: Path):
- with run_ledger(tmp_path, run="r1"):
- MeteredChatModel(FakeChat()).generate(ChatRequest(messages=[ChatMessage.user("x")], label="planner"))
- assert (tmp_path / "telemetry" / "cost.jsonl").is_file() and len(load_ledger(tmp_path)) == 1
- assert not (tmp_path / "cost_ledger.jsonl").exists(), "the root alias went on 2026-09-22"
-
def test_accounting_never_breaks_a_call(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
def boom(*a: object, **k: object) -> None:
diff --git a/harness/tests/cost/test_price_hygiene.py b/harness/tests/cost/test_price_hygiene.py
index 0cafc7ce..63d402d3 100644
--- a/harness/tests/cost/test_price_hygiene.py
+++ b/harness/tests/cost/test_price_hygiene.py
@@ -117,16 +117,3 @@ def test_every_price_row_was_checked_within_the_maintenance_window():
stale.append(f"{prov}:{model} ({age} days)")
assert not stale, f"price rows older than {STALE_AFTER_DAYS} days: {stale}"
-
-def test_a_ledger_row_carries_the_provenance_of_the_price_it_used(tmp_path):
- """The audit trail: which row produced this dollar, and can we stand behind it."""
- from codeverse3d.contracts.common import Usage as U
- from codeverse3d.cost import record_call
-
- row = record_call(U(backend="gemini", model="gemini-3.1-pro-preview", input_tokens=1_000,
- output_tokens=100), run="r", stage="judge", ledger=tmp_path / "l.jsonl")
- assert row.price_source == "exact" and row.price_approximate is False
- assert row.price_checked and row.price_input == 2.0 and row.price_output == 12.0
- unknown = record_call(U(backend="gemini", model="gemini-9.9-imaginary", input_tokens=1_000),
- run="r", stage="judge", ledger=tmp_path / "l.jsonl")
- assert unknown.price_source == "unknown" and unknown.price_approximate is True
diff --git a/harness/tests/cost/test_profiles.py b/harness/tests/cost/test_profiles.py
index fa12d7fb..123e2e79 100644
--- a/harness/tests/cost/test_profiles.py
+++ b/harness/tests/cost/test_profiles.py
@@ -29,8 +29,6 @@ def test_the_three_profiles_are_a_monotone_dial():
assert usd == sorted(usd) and usd[0] < usd[-1]
rounds = [PROFILES[n].rounds for n in PROFILE_NAMES]
assert rounds == sorted(rounds)
- assert PROFILES["quality"].candidates == 2 and PROFILES["quality"].texture is True
- assert PROFILES["economy"].texture is False and PROFILES["economy"].candidates == 1
# every profile explains itself and cites what it was measured at
for p in PROFILES.values():
assert p.expected_score and p.note and p.generator and p.judge
@@ -40,8 +38,7 @@ def test_balanced_is_todays_defaults():
p = PROFILES["balanced"]
s = Settings()
assert (p.generator, p.planner, p.judge) == (s.default_generator, s.default_planner, s.default_judge)
- assert p.rounds == 4 and p.candidates == s.default_candidates and p.judge_samples == 1
- assert p.max_minutes == 60.0
+ assert p.candidates == s.default_candidates
def test_a_value_the_user_configured_survives_the_profile_unless_forced():
@@ -94,7 +91,7 @@ def test_unknown_profile_is_a_clear_error():
get_profile("cheapest")
-def test_a_bogus_profile_name_is_a_typed_cli_error_not_a_traceback(monkeypatch, tmp_path):
+def test_a_bogus_profile_name_is_a_typed_cli_error_not_a_traceback(monkeypatch):
"""An invalid environment profile yields one clean validation error."""
runner = CliRunner()
monkeypatch.setenv("C3D_PROFILE", "bogus")
@@ -107,13 +104,7 @@ def test_a_bogus_profile_name_is_a_typed_cli_error_not_a_traceback(monkeypatch,
assert "Traceback" not in out
finally:
get_settings.cache_clear()
- monkeypatch.delenv("C3D_PROFILE")
- get_settings.cache_clear()
- r = runner.invoke(app, ["make", "x", "--profile", "bogus", "--no-run",
- "--runs-dir", str(tmp_path / "runs"), "--slug", "b2"])
- out = " ".join(r.output.split())
- assert r.exit_code == 2 and "unknown profile 'bogus'" in out and "Traceback" not in out
- get_settings.cache_clear()
+ # `make --profile bogus`: flywheel_cli/test_cli.py test_an_unknown_profile_is_a_clean_error_not_a_traceback
def test_profile_table_and_cli():
diff --git a/harness/tests/flywheel_cli/test_flywheel.py b/harness/tests/flywheel_cli/test_flywheel.py
index 9cdbc348..75500a9f 100644
--- a/harness/tests/flywheel_cli/test_flywheel.py
+++ b/harness/tests/flywheel_cli/test_flywheel.py
@@ -19,7 +19,6 @@ from codeverse3d.addons.dataset.quality import (
code_fingerprint,
normalise_code,
)
-from codeverse3d.contracts.run import RunRecord
from codeverse3d.record import _git
from codeverse3d.record.record import (
RecordError,
@@ -27,7 +26,6 @@ from codeverse3d.record.record import (
iter_runs,
load_record,
)
-from codeverse3d.workspace import Workspace
# --------------------------------------------------------------------------- record
@@ -271,7 +269,6 @@ def test_build_index_and_queries(runs_dir: Path, tmp_path: Path):
con.close()
s = summary(db)
assert {r["language"] for r in s} == {"blender", "threejs"}
- assert isinstance(load_record(Workspace(runs_dir / "lamp_three")), RunRecord)
# --------------------------------------------------------------------------- finding: repair pairs (pairs.py:115)
diff --git a/harness/tests/flywheel_cli/test_quality_gallery.py b/harness/tests/flywheel_cli/test_quality_gallery.py
index bd4e1e1b..2b295fbd 100644
--- a/harness/tests/flywheel_cli/test_quality_gallery.py
+++ b/harness/tests/flywheel_cli/test_quality_gallery.py
@@ -1,4 +1,4 @@
-"""Quality tiers, (code, prompt) dedupe, richer meta.json, captions side-car, gallery."""
+"""Quality tiers, (code, prompt) dedupe, richer meta.json, captions side-car."""
from __future__ import annotations
@@ -146,8 +146,3 @@ def test_caption_out_dir_leaves_run_untouched(fake_run, tmp_path: Path):
assert data["provenance"]["captioner"] == "fake:fake" and data["provenance"]["images_used"][0].startswith("artifacts/")
assert load_captions(ws, load_record(ws), side)["detailed"] == GOOD["detailed"]
assert load_captions(ws, load_record(ws), None) == {}
-
-
-# --------------------------------------------------------------------------- gallery
-
-
diff --git a/harness/tests/gallery/test_index.py b/harness/tests/gallery/test_index.py
index 91aa2e3f..202a5a10 100644
--- a/harness/tests/gallery/test_index.py
+++ b/harness/tests/gallery/test_index.py
@@ -86,7 +86,7 @@ def test_filter_and_sort_and_summary(gallery_tree: dict[str, Path]):
"art_easy_hinge", "ctrl_med_toaster", "half_written", "not_started"}
s = summarize([e for e in entries if e.state == "ok"])
assert s.n == 4 and s.n_judged == 4 and s.mean_score is not None and s.median_score is not None
- assert s.total_usd > 0 and not hasattr(s, "pass_rate")
+ assert s.total_usd > 0
facets = index.facets()
assert facets["track"] == ["articulated_object", "static_object"]
assert facets["battery"] == ["runs", "static_v9"]
diff --git a/harness/tests/gallery/test_page.py b/harness/tests/gallery/test_page.py
index d46f58f3..b2b4f7f6 100644
--- a/harness/tests/gallery/test_page.py
+++ b/harness/tests/gallery/test_page.py
@@ -75,7 +75,7 @@ def test_static_build_parses_and_is_self_contained(gallery_tree: dict[str, Path]
assert markup.startswith("<!doctype html>")
assert "data:image/jpeg;base64," in markup # --embed inlined the sheets
assert any(u.startswith("file://") for u in checker.urls) # links point at the run dirs
- assert "gallery-data" in checker.ids and "s-cost" in checker.ids and "s-perpass" not in checker.ids
+ assert "gallery-data" in checker.ids and "s-cost" in checker.ids
assert markup.count("<article class='card") == 6
for slug in ("wooden_chair_ab12cd34", "half_written", "not_started"):
assert slug in markup
diff --git a/harness/tests/gallery/test_triage.py b/harness/tests/gallery/test_triage.py
index 0c4e7597..dd249316 100644
--- a/harness/tests/gallery/test_triage.py
+++ b/harness/tests/gallery/test_triage.py
@@ -26,7 +26,6 @@ from codeverse3d.addons.gallery.index import build_index, hero_view
from codeverse3d.addons.gallery.model import (
VERDICTS,
humanize_view,
- match,
summarize,
verdict_breakdown,
)
@@ -74,13 +73,6 @@ def test_the_page_states_the_breakdown_and_it_adds_up(gallery_tree: dict[str, Pa
# --------------------------------------------------------------------------- verdict filter
[email protected](("verdict", "n"), [("judged", 4), ("error", 2), ("unjudged", 0)])
-def test_verdict_filter_selects_exactly_its_bucket(gallery_tree: dict[str, Path], verdict: str, n: int):
- entries = build_index([gallery_tree["runs"], gallery_tree["battery"]]).entries()
- kept = [e for e in entries if match(e, {"verdict": verdict})]
- assert len(kept) == n and all(e.verdict == verdict for e in kept)
-
-
def test_verdict_filter_reaches_the_api_and_the_page(gallery_tree: dict[str, Path]):
app = GalleryApp([gallery_tree["runs"], gallery_tree["battery"]])
payload = json.loads(app.route("/api/runs", {"verdict": "error"}).body)
diff --git a/harness/tests/languages/test_gl_common_entry.py b/harness/tests/languages/test_gl_common_entry.py
index af742169..3d5cde10 100644
--- a/harness/tests/languages/test_gl_common_entry.py
+++ b/harness/tests/languages/test_gl_common_entry.py
@@ -2,18 +2,11 @@
from __future__ import annotations
-import codeverse3d.languages.glsl_shader as wrap
from codeverse3d.contracts.common import ENTRY_FILE, Language
from codeverse3d.languages import _gl_common
from codeverse3d.spatial.gl_render import GlHost
-def test_wrap_reexports_moved_glsl_log_types() -> None:
- assert wrap.parse_glsl_log is _gl_common.parse_glsl_log
- assert wrap.GlslMessage is _gl_common.GlslMessage
- assert wrap.LineMap is _gl_common.LineMap and wrap.Segment is _gl_common.Segment
-
-
def test_make_host_prefers_injected_host() -> None:
injected = GlHost(gpu="off", timeout_s=1.0)
assert _gl_common.make_host(injected, 99.0) is injected
diff --git a/harness/tests/reference/test_attach.py b/harness/tests/reference/test_attach.py
index b154e4a1..756f2c7b 100644
--- a/harness/tests/reference/test_attach.py
+++ b/harness/tests/reference/test_attach.py
@@ -60,9 +60,3 @@ def test_front_elevation_is_the_silhouette_target(tmp_path: Path):
def test_three_quarter_is_the_target_when_it_is_the_only_survivor(tmp_path: Path):
refs = reference_images(_set(tmp_path, ("three_quarter", "front"), accepted=(True, False)))
assert len(refs) == 1 and refs[0].role == "target" and Path(refs[0].path).name == "three_quarter.png"
-
-
-def test_rejected_set_leaves_the_spec_alone(tmp_path: Path):
- spec = make_spec()
- out, why = attach(spec, _set(tmp_path, accepted=(False, False)))
- assert out is spec and "running without one" in why