Skip to content

Package doctests depend on a live SourceForge HTTP fetch (CI flakiness risk) #1

Description

@thorwhalen

Now that testpaths includes the package dir, CI collects and runs the
MajorSystem doctest in hm/phonemes.py. That doctest is not hermetic: the
first attribute access downloads the full CMU Pronouncing Dictionary
(cmudict-0.7b, ~3.6 MB) over plain HTTP from the SourceForge SVN web view.

The chain is:

MajorSystem.term_to_phones -> Phone.tp -> _get_cmu_raw_data_text -> pyckup.grab(url_term_and_phones)

pyckup.grab does no caching, so every test job in the matrix (3.10, 3.12,
Windows) re-downloads it. It works today — three green jobs, ~2.2s each — but
it means:

  • CI turns red whenever SourceForge is down, slow, rate-limits GitHub runners,
    or the SVN path changes.
  • The dependency is over http://, not https://.
  • Nothing can be tested offline.

Suggested fixes, roughly in order of effort:

  1. Cache the fetch locally (e.g. a dol-backed cache under the user data dir,
    or functools.lru_cache plus an on-disk store) so repeated runs and repeated
    jobs hit the network at most once.
  2. Ship a small fixture slice of the dictionary in the package and point the
    doctest at it, keeping the live URL as the default for real use.
  3. Failing both, mark the network-dependent doctest examples so they are skipped
    when the fetch fails, rather than failing the build.

Option 1 is the most valuable regardless of CI — it also makes the library
pleasant to use interactively.

Surfaced while widening testpaths in the repo-polish pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    manual-taskRequires the repo owner at the keyboard — agent cannot proceed on its own.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions