# Peculiar behavior with Pkg.test

**URL:** <https://discourse.julialang.org/t/peculiar-behavior-with-pkg-test/68540>\
**Category:** General Usage\
**Created:** [September 21, 2021, 4:48pm UTC](https://discourse.julialang.org/t/peculiar-behavior-with-pkg-test/68540 "2021-09-21T16:48:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josiah\_Slack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josiah_slack/32/8319_2.png) [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Post date:** [September 21, 2021, 4:48pm UTC](https://discourse.julialang.org/t/peculiar-behavior-with-pkg-test/68540/1 "2021-09-21T16:48:36Z")

</div>

Unfortunately, I’m going to have to describe my problem in pretty general terms; I don’t know of a simple way of inducing it, and it’s not practical to include the actual code involved. I have a package that I’m writing unit tests for. Among other things, it uses CUDA for some of its computations. I’m finding that if I’m in the Pkg environment and launch the unit tests using `test`, CUDA throws an exception (throw\_api\_error - not especially illuminating to me). If, however, I set up a script that uses the same packages, data, calling sequences, etc. it sails through without the exception. If, from the REPL, I type `include("runtests.jl")`, the tests all pass and no exception is thrown. Any suggestions as to what might be going on?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 21, 2021, 8:02pm UTC](https://discourse.julialang.org/t/peculiar-behavior-with-pkg-test/68540/2 "2021-09-21T20:02:07Z")

</div>

Pkg.test run with bounds checking forced on by default. Not sure that is the issue here but you could try start julia with `--check-bounds=yes` and see if that reproduces the problem.

---

<div class="post-metadata">

**Author:** ![Josiah\_Slack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josiah_slack/32/8319_2.png) [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Post date:** [September 22, 2021, 12:52pm UTC](https://discourse.julialang.org/t/peculiar-behavior-with-pkg-test/68540/3 "2021-09-22T12:52:00Z")

</div>

Thank you - that’s a helpful insight. I just tried running my example with `--check-bounds=yes` and didn’t see the exception get thrown. Sigh. The hunt continues…

The code where the exception originates does have a block bounded by an `@inbounds` macro, so I’m going to focus my attention there.

---

<div class="post-metadata">

**Author:** ![Josiah\_Slack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josiah_slack/32/8319_2.png) [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Post date:** [September 22, 2021, 1:11pm UTC](https://discourse.julialang.org/t/peculiar-behavior-with-pkg-test/68540/4 "2021-09-22T13:11:56Z")

</div>

I was able to pass `--check-bounds=no` to `Pkg.test()` and no CUDA exception got thrown. So, thanks again!
