# How to pass/use \`julia\_args\` argument to \`Pkg.test()\`?

**URL:** <https://discourse.julialang.org/t/how-to-pass-use-julia-args-argument-to-pkg-test/64274>\
**Category:** General Usage\
**Tags:** pkg\
**Created:** [July 8, 2021, 12:24pm UTC](https://discourse.julialang.org/t/how-to-pass-use-julia-args-argument-to-pkg-test/64274 "2021-07-08T12:24:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnomotani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnomotani/32/26753_2.png) [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Post date:** [July 8, 2021, 12:24pm UTC](https://discourse.julialang.org/t/how-to-pass-use-julia-args-argument-to-pkg-test/64274/1 "2021-07-08T12:24:51Z")

</div>

I’d like to pass some option(s) to my tests, in particular a flag (or something) that I can pass to include extra (but slow) tests. I can see ([12. API Reference · Pkg.jl](https://pkgdocs.julialang.org/v1/api/#Pkg.test)) that `Pkg.test()` has keyword arguments `julia_args` and `test_args`, but I’m not sure how to use them. I think I can guess how to use `test_args`, but as I don’t want to test what happens when I pass `ARGS` to my package, `julia_args` sounds more like what I want. An example of how to use `julia_args` in the docs would be really helpful!

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 8, 2021, 12:33pm UTC](https://discourse.julialang.org/t/how-to-pass-use-julia-args-argument-to-pkg-test/64274/2 "2021-07-08T12:33:02Z")

</div>

> [@johnomotani](#):
>
> I’d like to pass some option(s) to my tests, in particular a flag (or something) that I can pass to include extra (but slow) tests.

> [@johnomotani](#):
>
> I think I can guess how to use `test_args` , but as I don’t want to test what happens when I pass `ARGS` to my package

I think this is what you want. `test_args` populates the `ARGS` global variable, and then you can query that in your test file. Example `test/runtests.jl` file:

```julia
if "run-slow-test" in ARGS
    # do slow stuff
end

```

and then use `test_args` like this:

```julia
Pkg.test(; test_args = ["run-slow-test"])

```

* * *

Anyway, here is an example of using `julia_args` for disabling color and setting number of threads:

```julia
Pkg.test(; julia_args = `--color=no --threads=4`)

```

---

<div class="post-metadata">

**Author:** ![johnomotani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnomotani/32/26753_2.png) [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Post date:** [July 8, 2021, 1:06pm UTC](https://discourse.julialang.org/t/how-to-pass-use-julia-args-argument-to-pkg-test/64274/3 "2021-07-08T13:06:22Z")

</div>

Ah, thanks @fredrikekre - so `julia_args` is really for passing command line arguments to julia itself (that don’t end up in `ARGS`). Makes sense in hindsight. I was looking for a way to pass ‘arguments’ to the tests, but I guess that doesn’t really make sense because the tests are really just `include()`'d, so setting up `ARGS` is the way to go. I still think a couple of examples would make the docs at [12. API Reference · Pkg.jl](https://pkgdocs.julialang.org/v1/api/#Pkg.test) clearer.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 8, 2021, 1:24pm UTC](https://discourse.julialang.org/t/how-to-pass-use-julia-args-argument-to-pkg-test/64274/4 "2021-07-08T13:24:36Z")

</div>

Agreed, do you want to add it? [JuliaLang/Pkg.jl/src/Pkg.jl](https://github.com/JuliaLang/Pkg.jl/edit/master/src/Pkg.jl) (line 187).
