Skip to content

Green CI: CouchDB integration tests + doctests need a live server #1

Description

@thorwhalen

CI stays red because the test suite and module doctests require a live CouchDB server, which the runner does not provide. The wads health-rollout mechanical fixes have landed; this issue tracks the remaining work to make CI green.

What's failing

(a) couchdol/tests/test_simple.py connects at collection time

The test uses default-argument instantiation:

def test_couchdb_store(s=CouchDbStore(), k=None, v=None):
    ...

Because CouchDbStore() is evaluated when the function is defined (at import/collection), pytest cannot even collect the module without a reachable CouchDB — it raises ConnectionRefused.

Fix: move instantiation into the test body, behind a reachability skip, e.g.:

def test_couchdb_store():
    if not _couchdb_reachable():
        pytest.skip("no CouchDB server reachable")
    s = CouchDbStore()
    ...

(b) couchdol/__init__.py doctests hit 127.0.0.1:5984

The module docstrings contain runnable doctests that construct persisters/stores and talk to CouchDB on the default host/port. With testpaths = ["couchdol"], these are collected and fail without a server.

Fix (either):

  • mark the connecting doctests with # doctest: +SKIP, or
  • add a CouchDB service container to the CI job, e.g.:
services:
  couchdb:
    image: couchdb:3
    env:
      COUCHDB_USER: admin
      COUCHDB_PASSWORD: admin
    ports:
      - 5984:5984

(c) testpaths already fixed

[tool.pytest.ini_options].testpaths now points at couchdol (was the nonexistent tests), and docsrc is excluded from CI test collection (its conf.py imports epythet, which isn't installed → ModuleNotFoundError).

Note

The test/doctest code itself was intentionally left untouched in the mechanical pass — the reachability-skip vs. service-container choice is a deferred design decision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions