# \]test fails in vscode

**URL:** <https://discourse.julialang.org/t/test-fails-in-vscode/128371>\
**Category:** VS Code\
**Tags:** vscode\
**Created:** [April 24, 2025, 2:06pm UTC](https://discourse.julialang.org/t/test-fails-in-vscode/128371 "2025-04-24T14:06:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![freeman](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@freeman](https://discourse.julialang.org/u/freeman)\
**Post date:** [April 24, 2025, 2:06pm UTC](https://discourse.julialang.org/t/test-fails-in-vscode/128371/1 "2025-04-24T14:06:32Z")

</div>

```julia
(MyPkg) pkg> test
     Testing MyPkg
      Status `/tmp/jl_SGBb6L/Project.toml`
  [ab5201b8] MyPkg v1.0.0 `~/repos/MyPkg.jl`
  [8dfed614] Test v1.11.0
      Status `/tmp/jl_SGBb6L/Manifest.toml`
  [ab5201b8] MyPkg v1.0.0 `~/repos/MyPkg.jl`
  [2a0f44e3] Base64 v1.11.0
  [b77e0a4c] InteractiveUtils v1.11.0
  [56ddb016] Logging v1.11.0
  [d6f4376e] Markdown v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization v1.11.0
  [8dfed614] Test v1.11.0
     Testing Running tests...
ERROR: julia: -t,--threads=<n>[,auto|<m>]; n must be an integer >= 1
ERROR: Package MyPkg errored during testing

```

`Project.toml`:

```julia
name = "MyPkg"
uuid = "e1850440-3ef3-40f4-a083-5ede0cc67044"
authors = ["---"]
version = "1.0.0"

[weakdeps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Test = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]

```

I’ve tried these two commands, and from the cmd line the tests run and pass:

> <https://github.com/JuliaLang/julia/issues/56458#issuecomment-2457553140>
>
> Scheduled testing of a very basic \`Test\` project with \`--threads=auto\` started h…anging three weeks ago - since Oct. 8, when Julia 1.11 was released.
> 
> The scheduled testing is using the \`julia:1\` container (which became synonymous with \`julia:1.11\` on Oct. 8) and the hang occurs while precompiling the test-project (when running tests).
> 
> The scheduled testing is simply running \`Pkg.test\` with \`--threads=auto\` for a project with only \`Test\` as a dependency: https://gitlab.com/stemann/julia-gitlab-ci-templates/-/tree/master/examples/Sample
> 
> \* Oct. 10: First failure on Julia 1.11.0: https://gitlab.com/stemann/julia-gitlab-ci-templates/-/jobs/8040350935
> \* Oct. 31: Most recent failure - on Julia 1.11.1: https://gitlab.com/stemann/julia-gitlab-ci-templates/-/jobs/8234833118
> 
> Without \`--threads=auto\` (using \`Pkg.test(; coverage = true)\`), the testing completes without issues (of course): https://gitlab.com/stemann/julia-gitlab-ci-templates/-/jobs/8234833097
> 
> "Stack trace" (Julia-style):
> \* \`Pkg.test(; coverage = true, julia\_args = \["--threads=auto"\])\`
> \*
> \`\`\`sh
> julia --project -e '
> @info """
> Testing...
> CI\_JULIA\_TEST\_THREADS: $(ENV\["CI\_JULIA\_TEST\_THREADS"\])
> CI\_JULIA\_TEST\_REPORTS: $(ENV\["CI\_JULIA\_TEST\_REPORTS"\])
> Sys.CPU\_THREADS: $(Sys.CPU\_THREADS)
> """
> \# ...
> if !using\_threads || VERSION \< v"1.5"
> if using\_threads
> ENV\["JULIA\_NUM\_THREADS"\] = Sys.CPU\_THREADS
> end
> if !using\_test\_reports
> Pkg.test(; coverage = true)
> else
> TestReports.test(; coverage = true)
> end
> else
> if !using\_test\_reports
> Pkg.test(; coverage = true, julia\_args = \["--threads=auto"\])
> else
> TestReports.test(; coverage = true, julia\_args = \["--threads=auto"\])
> end
> end
> '
> 
> \`\`\`
> \* \[stemann/julia-gitlab-ci-templates: templates.gitlab-ci.yaml#L197-258\](https://gitlab.com/stemann/julia-gitlab-ci-templates/-/blob/master/templates.gitlab-ci.yaml#L197-258)
> \* \[stemann/julia-gitlab-ci-templates: test.needs\_build.gitlab-ci.yaml\](https://gitlab.com/stemann/julia-gitlab-ci-templates/-/blob/master/jobs/test.needs\_build.gitlab-ci.yaml)
> \* \[stemann/julia-gitlab-ci-templates: .gitlab-ci.yml#L95-L111\](https://gitlab.com/stemann/julia-gitlab-ci-templates/-/blob/master/.gitlab-ci.yml#L95-L111)

I’m running julia on vscode with 4 threads, apparently, no idea if that’s the default or some accidental config on my side.

```julia
julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 40 × Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake-avx512)
Threads: 4 default, 0 interactive, 2 GC (on 40 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 0
  JULIA_PKG_USE_CLI_GIT = true

```

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [April 24, 2025, 2:30pm UTC](https://discourse.julialang.org/t/test-fails-in-vscode/128371/2 "2025-04-24T14:30:26Z")

</div>

[This post](https://discourse.julialang.org/t/get-error-julia-t-threads-n-auto-m-n-must-be-an-integer-1-when-running-test/128131/4) might be helpful. It looks like you may need to specify the number of threads in the VSCode settings for Julia.

**Update**

Click on the gearbox icon in the bottom left hand corner. Select Settings from the menu. Select Julia from the Extensions drop down menu. In the field Julia: Additional Args, click on Edit in settings.json" .

---

<div class="post-metadata">

**Author:** ![freeman](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@freeman](https://discourse.julialang.org/u/freeman)\
**Post date:** [April 24, 2025, 3:05pm UTC](https://discourse.julialang.org/t/test-fails-in-vscode/128371/3 "2025-04-24T15:05:01Z")

</div>

Ok solved thank you. Interestingly, the `julia.NumThreads` line that I have to add for this to work is _not_ used. It appears it that it’s used to set the `JULIA_NUM_THREADS` env variable, but I set it to 5 but I’m still running 4 threads.

Anyway don’t care, I can run tests from vscode now.

vscode is really good when it works, but it feels like it’s so complex that the configs break often.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [April 24, 2025, 3:34pm UTC](https://discourse.julialang.org/t/test-fails-in-vscode/128371/4 "2025-04-24T15:34:19Z")

</div>

No problem!

> [@freeman](#):
>
> vscode is really good when it works, but it feels like it’s so complex that the configs break often.

I have had generally good experience, but I realize things might break on different systems. I wonder whether it would be worth reporting the problem on GitHub and providing your system and version info.
