Skip to content

test: run doctests in CI, skip network-bound examples - #188

Merged
beaufour merged 1 commit into
masterfrom
test/doctest-hygiene
Oct 27, 2026
Merged

beaufour merged 1 commit into
masterfrom
test/doctest-hygiene

Conversation

@beaufour

@beaufour beaufour commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Docstring examples were never executed. This PR turns them on where they can actually run, and is explicit about where they can't:

  • pyproject.toml: testpaths = ["test", "flickr_api"] + addopts = "--doctest-modules" — the one offline doctest (SimpleCache) now runs as part of the suite.
  • conftest.py: skips flickr_api.auth's module docstring and flickr_api.objects.Walker's examples with a documented reason — both perform live Flickr API calls and cannot run in CI. (Stdlib doctest/pytest do not honor the NumPy-style __doctest_skip__ convention, hence the conftest hook.)
  • flickr_api/reflection.py bindings_to: the existing doctest asserted output that wasn't reproducible (got []), so it's converted to a plain code block rather than being enforced as a test with fake data.

Rebased onto current master: #189 already removed .coverage, so this PR no longer touches it. Also force-pushed earlier to drop accidentally stacked changes.

Local (rebuilt off fresh master at the exact head SHA): 292 passed, 2 skipped (the 2 skipped are the network-bound doctests), lint/mypy clean.

Test Plan

  • uv run pytest locally
  • ruff check, ruff format --check, mypy clean
  • CI green

Automated prep by Hermes maintainer.

@beaufour
beaufour force-pushed the test/doctest-hygiene branch from e6c7e3c to f47350f Compare October 27, 2026 12:53
- Enable --doctest-modules over testpaths [test, flickr_api]; the only
  offline doctest (SimpleCache) now runs in CI (325 tests).
- Skip the flickr_api.auth module docstring and objects.Walker examples
  in conftest.py: both require a live Flickr API connection.
- reflection.bindings_to: its example claimed an output that is not
  reproducible; converted to a plain (non-doctest) code block.
@beaufour
beaufour force-pushed the test/doctest-hygiene branch from f47350f to 786655e Compare October 27, 2026 13:10
@beaufour
beaufour merged commit 1ad3865 into master Oct 27, 2026
7 checks passed
@beaufour
beaufour deleted the test/doctest-hygiene branch October 27, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant