|
9 | 9 | * [Architecture Doc](https://docs.google.com/document/d/1pIaeQw0ocU6ApNgqTVRZuSwjJAbhCcmweMq6RiVYEic/edit?usp=sharing) |
10 | 10 | * [UML Diagram](https://drive.google.com/file/d/1FVrnYiuAR8ykqfOUa1NuoMyZ1abXzMPw/view?usp=drive_link) |
11 | 11 |
|
| 12 | +## Running Tests |
| 13 | + |
| 14 | +```bash |
| 15 | +uv sync # install dev deps (incl. pytest, pytest-cov) |
| 16 | +uv run pytest # full suite (skips network-marked tests if you add `-m "not network"`) |
| 17 | +uv run pytest tests/test_swe_components.py -v # one file, verbose |
| 18 | +uv run pytest -k name_token # one keyword |
| 19 | +``` |
| 20 | + |
| 21 | +Tests that need a live OSH server (e.g. `localhost:8282` running |
| 22 | +FakeWeatherDriver) are tagged `@pytest.mark.network`. CI skips them; locally |
| 23 | +you can include or exclude them: |
| 24 | + |
| 25 | +```bash |
| 26 | +uv run pytest -m "not network" # what CI runs |
| 27 | +uv run pytest -m network # only the live-server tests |
| 28 | +``` |
| 29 | + |
| 30 | +## Test Coverage |
| 31 | + |
| 32 | +Coverage is opt-in via [`pytest-cov`](https://pytest-cov.readthedocs.io/). The |
| 33 | +default `pytest` run is fast; add `--cov` when you want a report. |
| 34 | + |
| 35 | +```bash |
| 36 | +uv run pytest --cov # terminal summary + missing lines |
| 37 | +uv run pytest --cov --cov-report=html # HTML report at htmlcov/index.html |
| 38 | +uv run pytest --cov --cov-report=xml # coverage.xml (CI / Codecov-ready) |
| 39 | +``` |
| 40 | + |
| 41 | +Configuration lives in `pyproject.toml` under `[tool.coverage.*]` — branch |
| 42 | +coverage is on, source is scoped to `src/oshconnect`, and obvious dead lines |
| 43 | +(`if TYPE_CHECKING:`, `raise NotImplementedError`, etc.) are excluded. |
| 44 | + |
| 45 | +CI (`.github/workflows/tests.yaml`) runs the suite with `--cov` on every push |
| 46 | +across Python 3.12 / 3.13 / 3.14 and uploads `coverage.xml` as a workflow |
| 47 | +artifact (downloadable from the run page). |
| 48 | + |
| 49 | +## Documentation Coverage |
| 50 | + |
| 51 | +[`interrogate`](https://interrogate.readthedocs.io/) reports what fraction of |
| 52 | +public modules / classes / functions / methods carry a docstring (presence |
| 53 | +only, it doesn't check style). It's purely informational right now; there's |
| 54 | +no CI gate. Configuration lives in `pyproject.toml` under `[tool.interrogate]` |
| 55 | +(`__init__`, dunder, private, and property/setter members are skipped). |
| 56 | + |
| 57 | +```bash |
| 58 | +uv run interrogate src/oshconnect # one-line summary |
| 59 | +uv run interrogate -v src/oshconnect # per-file table |
| 60 | +uv run interrogate -vv src/oshconnect # per-symbol (shows which symbols are missing) |
| 61 | +``` |
| 62 | + |
| 63 | +Once we agree on a baseline, raise `[tool.interrogate].fail-under` from `0` so |
| 64 | +new code without docstrings starts failing locally and in CI. |
| 65 | + |
12 | 66 | ## Generating the Docs |
13 | 67 |
|
14 | 68 | The documentation is built with [MkDocs](https://www.mkdocs.org/) using the |
|
0 commit comments