Skip to content

Commit

Permalink
docs: note object_verify tests and purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Sep 17, 2024
1 parent d591178 commit d97fd39
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,31 @@
* pytest files which end in `_api_calls.py` run last, and never run during the CI. It is currently incumbent on individual developers to confirm that these tests run successfully locally. In the future, part of the CI will be to spawn an AI-Horde and worker instances and test it there.


## Verifying the horde SDK API surface

You can run the following:

```bash
pytest -m "object_verify"
```

This will run the tests which validate the objects defined in the SDK are:
- In the appropriate place
- Match the live API (or if `AI_HORDE_DEV_URL` that version of the API)
- That the models are exposed via `__init__.py`
- And will run any other tests which ensure internal consistency.
- This generally does not include specific object validation beyond what can be automatically derived directly from the API docs or from general conventions from the SDK itself.
- If adding objects, you should add tests more specific to the expected functionality of that endpoint and the `object_verify` tests should only be treated as the bare-minimum.

## When the API adds an endpoint or changes a model
With the top level directory (the one that contains `pyproject.toml`) as your working directory:
```bash
python horde_sdk/scripts/write_all_payload_examples_for_tests.py
python horde_sdk/scripts/write_all_response_examples_for_tests.py
python docs/build_docs.py
```
This will update the data found in `tests/test_data/` from the default horde URL, or if any of the override environment variables are set, from there.
This will update the data found in `tests/test_data/` from the default horde URL, or if any of the override environment variables are set, from there.

Running `build_docs.py` will update any automatically generated mkdocs documentation stubs or resources (such as the API Model <-> SDK Model map).

Be sure to run the test suite (without any `*_api_calls.py` tests) after.


Be sure to run the test suite (without any `*_api_calls.py` tests) after. You may also may want to just start with `pytest -m "object_verify"` (see also the section on verifying the horde SDK API surface).

0 comments on commit d97fd39

Please sign in to comment.