Skip to content

Commit 3a77ad5

Browse files
authored
docs: Add contrib guide for tests (#307)
* docs: Add contrib guide for tests Signed-off-by: oliver könig <okoenig@nvidia.com> * add group tag Signed-off-by: oliver könig <okoenig@nvidia.com> --------- Signed-off-by: oliver könig <okoenig@nvidia.com>
1 parent 561bf3b commit 3a77ad5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ docker run --rm -it -w /workdir -v $(pwd):/workdir \
4141
megatron-bridge
4242
```
4343

44+
## 📝 Writing tests
45+
46+
We use [pytest](https://docs.pytest.org/en/stable/) for writing both unit and functional tests.
47+
48+
Unit tests aim to test functions in isolation. They generally do not depend on artifacts like Hugging Face checkpoints or larger datasets. Exception to this is a small toy dataset consisting of tokenizers.
49+
Unit tests are stored at `tests/unit_tests`. Please add your test to an existing folder or create a new one if no one matches.
50+
51+
Functional tests are integration tests that perform model training or operate on larger artifacts. We use pytest for writing these. In some cases, it might be desired to run your test (or parts of it) in a subprocess to avoid process contamination. We use `subprocess.Run` for this inside the pytest function. Please add your test into one of the predefined folders. If none of the folders matches semantically, please reach out to the `@nvidia-nemo/automation` in your PR for consultation.
52+
4453
## 📦 Dependencies management
4554

4655
We use [uv](https://docs.astral.sh/uv/) for managing dependencies. For reproducible builds, our project tracks the generated `uv.lock` file in the repository.

0 commit comments

Comments
 (0)