Skip to content

Commit d695969

Browse files
glwagnernavidcy
andauthored
Add info to docs about using the TEST_GROUP env variable (#5058)
* Put some info in the docs about running tests * add info in docs/contributing about running all tests within a group * format bash code snippets --------- Co-authored-by: Navid C. Constantinou <navidcy@users.noreply.github.com>
1 parent 0731c32 commit d695969

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

docs/src/contributing.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,20 @@ Oceananigans or by requesting something you think is missing.
126126

127127
* You can test to make sure Oceananigans works by typing in `] test`. (This is equivalent to
128128
`using Pkg; Pkg.test()`.) Doing so will run all the tests (and this can take a while).
129-
Alternatively, you can run only one test script file by providing its name as an environment
129+
Alternatively, we can run only one test script file by providing its name as an environment
130130
variable. For example, to run the tests only from the `test_coriolis.jl` file we call:
131131

132-
```
132+
```bash
133133
$ TEST_FILE=test_coriolis.jl julia --project -e"using Pkg; Pkg.test()"
134134
```
135135

136+
We can also run all the tests within a certain test group, as they are defined in [`test/runtest.jl`](https://github.com/CliMA/Oceananigans.jl/blob/main/test/runtests.jl).
137+
For example, to run all unit tests we call:
138+
139+
```bash
140+
$ TEST_GROUP=unit julia --project -e"using Pkg; Pkg.test()"
141+
```
142+
136143

137144
## Pull Requests
138145

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ using Pkg
22

33
include("dependencies_for_runtests.jl")
44

5+
# TEST_GROUP=unit julia --project -e 'using Pkg; Pkg.test()'
56
group = get(ENV, "TEST_GROUP", "all") |> Symbol
7+
8+
# TEST_FILE=test_coriolis.jl julia --project -e 'using Pkg; Pkg.test()'
69
test_file = get(ENV, "TEST_FILE", :none) |> Symbol
710

811
# if we are testing just a single file then group = :none

0 commit comments

Comments
 (0)