# Test package with check-bounds=no

**URL:** <https://discourse.julialang.org/t/test-package-with-check-bounds-no/123938>\
**Category:** New to Julia\
**Tags:** package\
**Created:** [December 17, 2024, 9:34pm UTC](https://discourse.julialang.org/t/test-package-with-check-bounds-no/123938 "2024-12-17T21:34:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Post date:** [December 17, 2024, 9:34pm UTC](https://discourse.julialang.org/t/test-package-with-check-bounds-no/123938/1 "2024-12-17T21:34:31Z")

</div>

Hi,

Is there a way to test a package with check-bounds=no?  
It seems that it isnalways yes by default.

I was thinking about something like:

```julia
pkg> test --check-bounds=no

```

Thank you

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 17, 2024, 10:09pm UTC](https://discourse.julialang.org/t/test-package-with-check-bounds-no/123938/2 "2024-12-17T22:09:03Z")

</div>

```julia
import Pkg
Pkg.test("MyPkg"; julia_args=`--check-bounds=auto`)

```

---

<div class="post-metadata">

**Author:** ![g-gundam](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/g-gundam/32/47593_2.png) [@g-gundam](https://discourse.julialang.org/u/g-gundam)\
**Post date:** [December 17, 2024, 10:25pm UTC](https://discourse.julialang.org/t/test-package-with-check-bounds-no/123938/3 "2024-12-17T22:25:15Z")

</div>

This was my first time seeing backticks used like that.

```julia
`--check-bounds=auto`

```

I was surprised to see that it wasn’t wrapped in double quotes, but I later discovered that `julia_args` wants a value of the type `Union{Cmd, AbstractVector{<:AbstractString}}`.

I didn’t know a Cmd could be non-executable.

---

<div class="post-metadata">

**Author:** ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Post date:** [December 18, 2024, 8:38am UTC](https://discourse.julialang.org/t/test-package-with-check-bounds-no/123938/4 "2024-12-18T08:38:16Z")

</div>

Thank you all for your feedbacks.  
I did not know that someone else could choose what the solution to my question is. (Just interesting to know)

1/ May I ask what is the rationale behind `--check-bounds=auto` instead of `--check-bounds=no`. It is not intuitive to me.

2/ Also what is the rationale behind having the REPL run with `--check-bounds=no` by default and package tests `--check-bounds=yes` by default? It would make more sense if they both run with the same options in the same session, no?

3/ Would it be nice to be able to do `pkg> test --check-bounds=no` or auto?

Thanks again.

---

<div class="post-metadata">

**Author:** ![jakobnissen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakobnissen/32/13477_2.png) [@jakobnissen](https://discourse.julialang.org/u/jakobnissen)\
**Post date:** [December 18, 2024, 8:47am UTC](https://discourse.julialang.org/t/test-package-with-check-bounds-no/123938/5 "2024-12-18T08:47:01Z")

</div>

1. If `--check-bounds` is `no`, that disables all boundschecking in the entire Julia process. That is considered way too unsafe, and so this option is not recommended.

2. By default, the REPL runs with `--check-bounds=auto`. The `auto` option is nether yes nor no. When it’s `auto`, then Julia will bounds check by default, except in `@inbounds` blocks. This allows the user to selectively disable boundschecking in small sections of code that the user has manually reviewed.

3. I think most people would want to run tests with bounds checking always enabled. This is because, if I make a mistake in some block that I have annotated `@inbounds` such that it reads out of bounds, I would want Julia to throw an exception in my test suite, instead of segfaulting or exhibiting undefined behaviour, which could lead to hard-to-diagnose bugs. Generally, I don’t care that my test suite runs a little bit slower. But I really do care that my test suite is able to pick up bugs in my code - after all, that’s what it’s there for.

---

<div class="post-metadata">

**Author:** ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Post date:** [December 18, 2024, 9:01am UTC](https://discourse.julialang.org/t/test-package-with-check-bounds-no/123938/6 "2024-12-18T09:01:49Z")

</div>

Thank you @jakobnissen.  
I think your points 2/ and 3/ answer and correct my assumptions of my question 2/.  
My question 3/ was about a feature request in the REPL/package manager command.
