Skip to content

Commit

Permalink
contributing: Explain how to run common tests
Browse files Browse the repository at this point in the history
As a beginning contributor, it is far from obvious where to find tests,
how to run individual tests locally for quick development, and which
tests do what. The new "Testing changes" section aims to help with all
of these.

Co-authored-by: Emily <[email protected]>
  • Loading branch information
l0b0 and emilylange committed Jun 19, 2023
1 parent eed76b7 commit 96299ed
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ Pull requests should not be squash merged in order to keep complete commit messa
This means that, when addressing review comments in order to keep the pull request in an always mergeable status, you will sometimes need to rewrite your branch's history and then force-push it with `git push --force-with-lease`.
Useful git commands that can help a lot with this are `git commit --patch --amend` and `git rebase --interactive`. For more details consult the git man pages or online resources like [git-rebase.io](https://git-rebase.io/) or [The Pro Git Book](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History).

## Testing changes

To run the main types of tests locally:

- Run package-internal tests with `nix-build --attr pkgs.PACKAGE.passthru.tests`
- Run [NixOS tests](https://nixos.org/manual/nixos/unstable/#sec-nixos-tests) with `nix-build --attr nixosTest.NAME`, where `NAME` is the name of the test listed in `nixos/tests/all-tests.nix`
- Run [global package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests) with `nix-build --attr tests.PACKAGE`, where `PACKAGE` is the name of the test listed in `pkgs/test/default.nix`
- See `lib/tests/NAME.nix` for instructions on running specific library tests

## Rebasing between branches (i.e. from master to staging)

From time to time, changes between branches must be rebased, for example, if the
Expand Down

0 comments on commit 96299ed

Please sign in to comment.