Skip to content

Commit ba1cd5e

Browse files
authored
Add interactive usage example (#60)
1 parent 5020eda commit ba1cd5e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,43 @@ end
9191
runtests(MyModule, ARGS; init_code)
9292
```
9393

94+
### Interactive use
95+
96+
Arguments can also be passed via the standard `Pkg.test` interface for interactive control. For example, here is how we could run the subset of tests that start with the testset name "MyTestsetA" in i) verbose mode, and ii) with default threading enabled:
97+
98+
```julia-repl
99+
# In an environment where `MyPackage.jl` is available
100+
julia --proj
101+
102+
julia> using Pkg
103+
104+
# No need to start a fresh session to change threading
105+
julia> Pkg.test("MyModule"; test_args=`--verbose MyTestsetA`, julia_args=`--threads=auto`);
106+
```
107+
Alternatively, arguments can be passed directly from the command line with a shell alias like the one below:
108+
109+
```julia-repl
110+
jltest --threads=auto -- --verbose MyTestsetA
111+
```
112+
113+
<details><summary>Shell alias</summary>
114+
115+
```shell
116+
function jltest {
117+
julia=(julia)
118+
119+
# certain arguments (like those beginnning with a +) need to come first
120+
if [[ $# -gt 0 && "$1" = +* ]]; then
121+
julia+=("$1")
122+
shift
123+
fi
124+
125+
"${julia[@]}" --startup-file=no --project -e "using Pkg; Pkg.API.test(; test_args=ARGS)" "$@"
126+
}
127+
```
128+
129+
</details>
130+
94131
## Packages using ParallelTestRunner.jl
95132

96133
There are a few packages already using `ParallelTestRunner.jl` to parallelize their tests, you can look at their setups if you need inspiration to move your packages as well:

0 commit comments

Comments
 (0)