test_shared_parse.py

tests/test_shared_parse.py

gh#358 — one parse per file, ten stages, ten independent cache keys.

test_every_harvester_subclass_is_reachable_from_the_plan

None test_shared_parse.test_every_harvester_subclass_is_reachable_from_the_plan()

Every harvester the codebase defines is one the shared pass warms.

tests/test_shared_parse.py:360

Checks

  • assert not missing, (f"harvester stage(s) {sorted(missing)} run outside the shared parse, so each one " "re-parses every indexed file — the defect that cost 29.5 s of a 130 s cold build " "when macro_refs did it. Add the harvester to HarvestPlan and to active()." )
  • assert {"dispatch", "subscribe"} <= fields

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-006measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → shared_key_harvester → resolve_shared_key_patterns
REQ-DDB-INDEX-002inferredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → lock_harvester → manifest_key → hash_file
REQ-DDB-INDEX-010measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → includes_harvester
REQ-DDB-INDEX-011measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → property_key_harvester
REQ-DDB-PIPE-003measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan
REQ-DDB-PIPE-007measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → gate_harvester
REQ-DDB-PIPE-012measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → js_symbol_harvester
REQ-DDB-PIPE-013measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → docstring_harvester
REQ-DDB-PIPE-015measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → defaults_harvester
REQ-DDB-SCHEMA-001measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → spawn_harvester
REQ-DDB-SCHEMA-004inferredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → dispatch_harvester
REQ-DDB-SCHEMA-005measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → shared_key_harvester
REQ-DDB-SCHEMA-011measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → lock_harvester
REQ-DDB-SCHEMA-012measuredtest_every_harvester_subclass_is_reachable_from_the_plan → build_harvest_plan → lock_harvester → load_lock_patterns → declaration_origin
REQ-DDB-WIKI-034measured
Source · 48 lines
def test_every_harvester_subclass_is_reachable_from_the_plan() -> None:
    """THE GUARD THAT WOULD HAVE CAUGHT `macro_refs`, AND THE REASON IT IS STRUCTURAL.

    `test_stages_after_shared_pass_do_not_parse` iterates a hand-built list, so a stage absent
    from that list is invisible to it — it passed for as long as `macro_refs` drove its own
    full-tree parse, costing 29.5 s of a 130 s cold build. A test that enumerates the thing it
    is checking cannot detect an omission FROM that thing.

    So this enumerates `Harvester.__subclasses__()` after importing the whole package: the
    codebase's own answer to "what harvesters exist", which no plan edit can shrink. A new
    harvester that forgets the plan fails here on the day it is written, with a message naming
    the cost of not fixing it.

    @brief No harvester runs outside the shared parse.
    @version 1
    """
    import importlib
    import pkgutil

    import clew
    from clew.harvest_plan import HarvestPlan, build_harvest_plan

    ## Subclasses only register once their module is imported, and the pipeline imports them
    ## lazily — so without this walk the set is whatever earlier tests happened to touch, and
    ## the assertion would silently weaken as import order changed.
    for mod in pkgutil.iter_modules(clew.__path__):
        importlib.import_module(f"clew.{mod.name}")

    ## SCOPED TO THE PACKAGE. `__subclasses__()` sees every subclass alive in the interpreter,
    ## including this module's own `_CountingHarvester` test double — which carries the base
    ## class's empty `stage` and made the first run of this guard fail on `['']`. Filtering by
    ## `__module__` asks the question that was meant: what does *clew* define?
    defined = {
        cls.stage for cls in Harvester.__subclasses__() if cls.__module__.startswith("clew.")
    }
    warmed = {h.stage for h in build_harvest_plan().active()}
    fields = set(HarvestPlan.__dataclass_fields__)

    missing = defined - warmed - _CONDITIONAL_STAGES
    assert not missing, (
        f"harvester stage(s) {sorted(missing)} run outside the shared parse, so each one "
        "re-parses every indexed file — the defect that cost 29.5 s of a 130 s cold build "
        "when macro_refs did it. Add the harvester to HarvestPlan and to active()."
    )
    ## The conditional half: absent from a plan built with no manifests, but they must still be
    ## the PLAN's to construct. Named fields rather than instances, because that is the property
    ## that survives a build which declares nothing.
    assert {"dispatch", "subscribe"} <= fields

1 more lines, not shown

Activity · 12 steps
lines 376–376import importliblines 377–377import pkgutillines 379–379import clewlines 380–380from clew.harvest_plan import HarvestPlan, build_harvest_planlines 385–385◇ for mod in pkgutil.iter_modules(clew.__path__)lines 386–386importlib.import_module(f"clew.{mod.name}")lines 392–394defined = { cls.stage for cls in Harvester.__subclasses__() if cls.__module__.startswith("clew.") }lines 395–395warmed = {h.stage for h in build_harvest_plan().active()}lines 396–396fields = set(HarvestPlan.__dataclass_fields__)lines 398–398missing = defined - warmed - _CONDITIONAL_STAGESlines 399–403assert not missing, ( f"harvester stage(s) {sorted(missing)} run outside the shared parse, so each one " "re-parses every indexed file — the defect that cost 29.5 s of a 130 s cold build " "when macro_refs did it. Add the harvester to HarvestPlan and to active()." )lines 407–407assert {"dispatch", "subscribe"} <= fields

test_one_stage_version_bump_recomputes_only_that_stage

None test_shared_parse.test_one_stage_version_bump_recomputes_only_that_stage(tuple[Path, Path, Path] indexed_repo, pytest.MonkeyPatch monkeypatch)

Bumping ONE stage's version recomputes ONE stage.

tests/test_shared_parse.py:211

Show on the map →

Called by none

Calls _fixture_stages, run_shared_parse

Checks

  • assert len(counter.paths) == len(_FILES)
  • assert tally.computed == len(_FILES)
  • assert tally.cached == len(_FILES) * (len(stages) - 1)
  • assert (stages[1].stage, stages[1].stage_version, len(_FILES)) in rows
  • assert (stages[1].stage, stages[1].stage_version - 1, len(_FILES)) in rows

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measured
REQ-DDB-PIPE-003measuredtest_one_stage_version_bump_recomputes_only_that_stage → run_shared_parse
REQ-DDB-PIPE-011measuredtest_one_stage_version_bump_recomputes_only_that_stage → run_shared_parse → _shared_parse_one_file → _ast_parse_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_one_stage_version_bump_recomputes_only_that_stage → run_shared_parse → _shared_parse_one_file → _ast_parse_one_file → _ts_language_for → _grammar_available → has_language
Source · 36 lines
def test_one_stage_version_bump_recomputes_only_that_stage(
    indexed_repo: tuple[Path, Path, Path],
    monkeypatch: pytest.MonkeyPatch,
) -> None:
    """THE CONTROL THAT FORBIDS A COMBINED CACHE KEY. Sharing the parse is only safe
    while the KEYS stay separate: a merged key would either invalidate all four
    stages here (all-or-nothing) or serve a stale slice for the bumped one (lossy).
    Either shows up as a `computed` count that is not exactly one stage's worth.

    @brief One invalidated stage costs one stage's recomputation.
    @version 1
    """
    repo, db, cache_path = indexed_repo
    cache, stages = _fixture_stages(repo, cache_path)
    conn = sqlite3.connect(str(db))
    run_shared_parse(conn, repo, stages, cache)

    stages[1].stage_version += 1
    counter = _ParseCounter()
    monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)
    tally = run_shared_parse(conn, repo, stages, cache)
    conn.close()

    # Each file is still parsed at most once, and only the bumped stage recomputes.
    assert len(counter.paths) == len(_FILES)
    assert tally.computed == len(_FILES)
    assert tally.cached == len(_FILES) * (len(stages) - 1)
    # The superseded rows are left alone: invalidation is by KEY, not by deletion.
    rows = cache.conn.execute(
        "SELECT stage, stage_version, COUNT(*) FROM extract_cache "
        "GROUP BY stage, stage_version ORDER BY stage, stage_version",
    ).fetchall()
    assert (stages[1].stage, stages[1].stage_version, len(_FILES)) in rows
    assert (stages[1].stage, stages[1].stage_version - 1, len(_FILES)) in rows

Activity · 15 steps
lines 223–223repo, db, cache_path = indexed_repolines 224–224cache, stages = _fixture_stages(repo, cache_path)lines 225–225conn = sqlite3.connect(str(db))lines 226–226run_shared_parse(conn, repo, stages, cache)lines 228–228stages[1].stage_version += 1lines 229–229counter = _ParseCounter()lines 230–230monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)lines 231–231tally = run_shared_parse(conn, repo, stages, cache)lines 232–232conn.close()lines 235–235assert len(counter.paths) == len(_FILES)lines 236–236assert tally.computed == len(_FILES)lines 237–237assert tally.cached == len(_FILES) * (len(stages) - 1)lines 239–242rows = cache.conn.execute( "SELECT stage, stage_version, COUNT(*) FROM extract_cache " "GROUP BY stage, stage_version ORDER BY stage, stage_version", ).fetchall()lines 243–243assert (stages[1].stage, stages[1].stage_version, len(_FILES)) in rowslines 244–244assert (stages[1].stage, stages[1].stage_version - 1, len(_FILES)) in rows

test_pair_accounting_is_not_double_counted

None test_shared_parse.test_pair_accounting_is_not_double_counted(tuple[Path, Path, Path] indexed_repo)

One (file, stage) payload is counted once, not once per consumer.

tests/test_shared_parse.py:323

Show on the map →

Called by none

Calls _fixture_stages, run_harvest, run_shared_parse

Checks

  • assert (cache.hits, cache.misses) == (0, len(_FILES) * len(stages))
  • assert (warm.hits, warm.misses) == (len(_FILES) * len(stages), 0)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measured
REQ-DDB-PIPE-003measuredtest_pair_accounting_is_not_double_counted → run_harvest
REQ-DDB-PIPE-011measuredtest_pair_accounting_is_not_double_counted → run_harvest → _harvest_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_pair_accounting_is_not_double_counted → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language
Source · 28 lines
def test_pair_accounting_is_not_double_counted(
    indexed_repo: tuple[Path, Path, Path],
) -> None:
    """`misses` is published as the index's `payloads_recomputed` and `status` shows it
    to an agent deciding whether to trust an answer. Since the shared pass COMPUTES
    what the stages then READ, naive counting would report a fully cold build as
    fully missed AND fully hit at the same time.

    @brief A cold build reports misses only; a warm one reports hits only.
    @version 1
    """
    repo, db, cache_path = indexed_repo
    cache, stages = _fixture_stages(repo, cache_path)
    conn = sqlite3.connect(str(db))
    run_shared_parse(conn, repo, stages, cache)
    for stage in stages:
        run_harvest(conn, repo, stage, cache)
    assert (cache.hits, cache.misses) == (0, len(_FILES) * len(stages))
    cache.conn.commit()

    warm = IndexCache(cache_path, repo)
    run_shared_parse(conn, repo, stages, warm)
    for stage in stages:
        run_harvest(conn, repo, stage, warm)
    conn.close()
    assert (warm.hits, warm.misses) == (len(_FILES) * len(stages), 0)

Activity · 14 steps
lines 334–334repo, db, cache_path = indexed_repolines 335–335cache, stages = _fixture_stages(repo, cache_path)lines 336–336conn = sqlite3.connect(str(db))lines 337–337run_shared_parse(conn, repo, stages, cache)lines 338–338◇ for stage in stageslines 339–339run_harvest(conn, repo, stage, cache)lines 340–340assert (cache.hits, cache.misses) == (0, len(_FILES) * len(stages))lines 341–341cache.conn.commit()lines 343–343warm = IndexCache(cache_path, repo)lines 344–344run_shared_parse(conn, repo, stages, warm)lines 345–345◇ for stage in stageslines 346–346run_harvest(conn, repo, stage, warm)lines 347–347conn.close()lines 348–348assert (warm.hits, warm.misses) == (len(_FILES) * len(stages), 0)

test_rebuild_still_parses_each_file_once

None test_shared_parse.test_rebuild_still_parses_each_file_once(tuple[Path, Path, Path] indexed_repo, pytest.MonkeyPatch monkeypatch)

rebuild recomputes everything, but each file only once.

tests/test_shared_parse.py:285

Show on the map →

Called by none

Calls _fixture_stages, run_harvest, run_shared_parse

Checks

  • assert len(run_harvest(conn, repo, stage, rebuild)) == len(_FILES)
  • assert tally.computed == len(_FILES) * len(fresh)
  • assert tally.cached == 0
  • assert len(counter.paths) == len(_FILES)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measured
REQ-DDB-PIPE-003measuredtest_rebuild_still_parses_each_file_once → run_harvest
REQ-DDB-PIPE-011measuredtest_rebuild_still_parses_each_file_once → run_harvest → _harvest_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_rebuild_still_parses_each_file_once → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language
Source · 34 lines
def test_rebuild_still_parses_each_file_once(
    indexed_repo: tuple[Path, Path, Path],
    monkeypatch: pytest.MonkeyPatch,
) -> None:
    """`--rebuild` sets `read_enabled=False` so nothing on disk is trusted. Without
    the this-run exemption in `IndexCache._readable`, the shared pass would compute
    every payload and every stage would then MISS and parse again — `--rebuild`
    would be the one mode gh#358 did not fix, and nothing would say so.

    @brief A forced rebuild reuses its own recomputation.
    @version 1
    """
    repo, db, cache_path = indexed_repo
    warm, stages = _fixture_stages(repo, cache_path)
    conn = sqlite3.connect(str(db))
    run_shared_parse(conn, repo, stages, warm)
    warm.conn.commit()

    rebuild = IndexCache(cache_path, repo, read_enabled=False)
    fresh = [_CountingHarvester(f"probe_{n}") for n in range(4)]
    counter = _ParseCounter()
    monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)
    tally = run_shared_parse(conn, repo, fresh, rebuild)
    for stage in fresh:
        assert len(run_harvest(conn, repo, stage, rebuild)) == len(_FILES)
    conn.close()

    # Everything was recomputed (nothing on disk was trusted) …
    assert tally.computed == len(_FILES) * len(fresh)
    assert tally.cached == 0
    # … and yet each file was parsed exactly once, not once per stage.
    assert len(counter.paths) == len(_FILES)

Activity · 16 steps
lines 297–297repo, db, cache_path = indexed_repolines 298–298warm, stages = _fixture_stages(repo, cache_path)lines 299–299conn = sqlite3.connect(str(db))lines 300–300run_shared_parse(conn, repo, stages, warm)lines 301–301warm.conn.commit()lines 303–303rebuild = IndexCache(cache_path, repo, read_enabled=False)lines 304–304fresh = [_CountingHarvester(f"probe_{n}") for n in range(4)]lines 305–305counter = _ParseCounter()lines 306–306monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)lines 307–307tally = run_shared_parse(conn, repo, fresh, rebuild)lines 308–308◇ for stage in freshlines 309–309assert len(run_harvest(conn, repo, stage, rebuild)) == len(_FILES)lines 310–310conn.close()lines 313–313assert tally.computed == len(_FILES) * len(fresh)lines 314–314assert tally.cached == 0lines 316–316assert len(counter.paths) == len(_FILES)

test_shared_pass_parses_each_file_once

None test_shared_parse.test_shared_pass_parses_each_file_once(tuple[Path, Path, Path] indexed_repo, pytest.MonkeyPatch monkeypatch)

The shared pass parses each file once, whatever the stage count.

tests/test_shared_parse.py:145

Show on the map →

Called by none

Calls _fixture_stages, run_shared_parse

Checks

  • assert len(counter.paths) == len(_FILES)
  • assert sorted(counter.paths) == sorted(_FILES)
  • assert tally.parsed == len(_FILES)
  • assert tally.computed == len(_FILES) * len(stages)
  • assert tally.cached == 0
  • assert [len(s.harvested) for s in stages] == [len(_FILES)] * len(stages)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measured
REQ-DDB-PIPE-003measuredtest_shared_pass_parses_each_file_once → run_shared_parse
REQ-DDB-PIPE-011measuredtest_shared_pass_parses_each_file_once → run_shared_parse → _shared_parse_one_file → _ast_parse_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_shared_pass_parses_each_file_once → run_shared_parse → _shared_parse_one_file → _ast_parse_one_file → _ts_language_for → _grammar_available → has_language
Source · 29 lines
def test_shared_pass_parses_each_file_once(
    indexed_repo: tuple[Path, Path, Path],
    monkeypatch: pytest.MonkeyPatch,
) -> None:
    """THE gh#358 ASSERTION. Four stages over three files: three parses, twelve
    payloads. Before the shared pass the same work cost twelve parses, and the
    ratio is the whole saving — so this counts BOTH, because "3 parses" alone would
    also be satisfied by a pass that quietly dropped a stage.

    @brief One parse per file, one payload per (file, stage).
    @version 1
    """
    repo, db, cache_path = indexed_repo
    counter = _ParseCounter()
    monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)
    cache, stages = _fixture_stages(repo, cache_path)

    conn = sqlite3.connect(str(db))
    tally = run_shared_parse(conn, repo, stages, cache)
    conn.close()

    assert len(counter.paths) == len(_FILES)
    assert sorted(counter.paths) == sorted(_FILES)
    assert tally.parsed == len(_FILES)
    assert tally.computed == len(_FILES) * len(stages)
    assert tally.cached == 0
    assert [len(s.harvested) for s in stages] == [len(_FILES)] * len(stages)

Activity · 13 steps
lines 157–157repo, db, cache_path = indexed_repolines 158–158counter = _ParseCounter()lines 159–159monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)lines 160–160cache, stages = _fixture_stages(repo, cache_path)lines 162–162conn = sqlite3.connect(str(db))lines 163–163tally = run_shared_parse(conn, repo, stages, cache)lines 164–164conn.close()lines 166–166assert len(counter.paths) == len(_FILES)lines 167–167assert sorted(counter.paths) == sorted(_FILES)lines 168–168assert tally.parsed == len(_FILES)lines 169–169assert tally.computed == len(_FILES) * len(stages)lines 170–170assert tally.cached == 0lines 171–171assert [len(s.harvested) for s in stages] == [len(_FILES)] * len(stages)

test_stages_after_shared_pass_do_not_parse

None test_shared_parse.test_stages_after_shared_pass_do_not_parse(tuple[Path, Path, Path] indexed_repo, pytest.MonkeyPatch monkeypatch)

After the shared pass, every stage's own harvest parses nothing.

tests/test_shared_parse.py:179

Show on the map →

Called by none

Calls _fixture_stages, run_harvest, run_shared_parse

Checks

  • assert len(results) == len(_FILES)
  • assert counter.paths == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measured
REQ-DDB-PIPE-003measuredtest_stages_after_shared_pass_do_not_parse → run_harvest
REQ-DDB-PIPE-011measuredtest_stages_after_shared_pass_do_not_parse → run_harvest → _harvest_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_stages_after_shared_pass_do_not_parse → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language
Source · 27 lines
def test_stages_after_shared_pass_do_not_parse(
    indexed_repo: tuple[Path, Path, Path],
    monkeypatch: pytest.MonkeyPatch,
) -> None:
    """The saving only lands if the stages then find their rows. A stage whose key
    disagreed with the warmed one would re-parse and still produce correct rows —
    silently costing exactly what gh#358 set out to remove — so this asserts the
    ZERO, and asserts the payloads still arrive.

    @brief Warmed stages serve from cache and parse nothing.
    @version 1
    """
    repo, db, cache_path = indexed_repo
    cache, stages = _fixture_stages(repo, cache_path)
    conn = sqlite3.connect(str(db))
    run_shared_parse(conn, repo, stages, cache)

    counter = _ParseCounter()
    monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)
    for stage in stages:
        results = run_harvest(conn, repo, stage, cache)
        assert len(results) == len(_FILES)
    conn.close()

    assert counter.paths == []

Activity · 11 steps
lines 191–191repo, db, cache_path = indexed_repolines 192–192cache, stages = _fixture_stages(repo, cache_path)lines 193–193conn = sqlite3.connect(str(db))lines 194–194run_shared_parse(conn, repo, stages, cache)lines 196–196counter = _ParseCounter()lines 197–197monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)lines 198–198◇ for stage in stageslines 199–199results = run_harvest(conn, repo, stage, cache)lines 200–200assert len(results) == len(_FILES)lines 201–201conn.close()lines 203–203assert counter.paths == []

test_unchanged_tree_parses_nothing

None test_shared_parse.test_unchanged_tree_parses_nothing(tuple[Path, Path, Path] indexed_repo, pytest.MonkeyPatch monkeypatch)

An unchanged tree parses nothing at all on the next build.

tests/test_shared_parse.py:252

Show on the map →

Called by none

Calls _fixture_stages, run_shared_parse

Checks

  • assert counter.paths == []
  • assert tally.parsed == 0
  • assert tally.computed == 0
  • assert tally.cached == len(_FILES) * len(stages)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measured
REQ-DDB-PIPE-003measuredtest_unchanged_tree_parses_nothing → run_shared_parse
REQ-DDB-PIPE-011measuredtest_unchanged_tree_parses_nothing → run_shared_parse → _shared_parse_one_file → _ast_parse_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_unchanged_tree_parses_nothing → run_shared_parse → _shared_parse_one_file → _ast_parse_one_file → _ts_language_for → _grammar_available → has_language
Source · 28 lines
def test_unchanged_tree_parses_nothing(
    indexed_repo: tuple[Path, Path, Path],
    monkeypatch: pytest.MonkeyPatch,
) -> None:
    """The shared pass must not make an incremental refresh worse. It asks
    `extract_has` per (file, stage) and parses only when at least one misses, so a
    fully-cached tree costs existence checks and no parse — and no payload DECODE
    either, which is why `extract_has` exists rather than reusing `extract_get`.

    @brief A warm refresh does no parsing.
    @version 1
    """
    repo, db, cache_path = indexed_repo
    cache, stages = _fixture_stages(repo, cache_path)
    conn = sqlite3.connect(str(db))
    run_shared_parse(conn, repo, stages, cache)

    counter = _ParseCounter()
    monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)
    tally = run_shared_parse(conn, repo, stages, cache)
    conn.close()

    assert counter.paths == []
    assert tally.parsed == 0
    assert tally.computed == 0
    assert tally.cached == len(_FILES) * len(stages)

Activity · 12 steps
lines 264–264repo, db, cache_path = indexed_repolines 265–265cache, stages = _fixture_stages(repo, cache_path)lines 266–266conn = sqlite3.connect(str(db))lines 267–267run_shared_parse(conn, repo, stages, cache)lines 269–269counter = _ParseCounter()lines 270–270monkeypatch.setattr(harvest, "_ast_parse_one_file", counter)lines 271–271tally = run_shared_parse(conn, repo, stages, cache)lines 272–272conn.close()lines 274–274assert counter.paths == []lines 275–275assert tally.parsed == 0lines 276–276assert tally.computed == 0lines 277–277assert tally.cached == len(_FILES) * len(stages)