# Test can't see packages in main project

**URL:** <https://discourse.julialang.org/t/test-cant-see-packages-in-main-project/135859>\
**Category:** New to Julia\
**Created:** [February 26, 2026, 11:30am UTC](https://discourse.julialang.org/t/test-cant-see-packages-in-main-project/135859 "2026-02-26T11:30:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magnus\_Lilledahl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magnus_lilledahl/32/51079_2.png) [@Magnus\_Lilledahl](https://discourse.julialang.org/u/Magnus_Lilledahl)\
**Post date:** [February 26, 2026, 11:30am UTC](https://discourse.julialang.org/t/test-cant-see-packages-in-main-project/135859/1 "2026-02-26T11:30:27Z")

</div>

I am trying to use workspaces for adding tests to a project. I have added

```julia-auto
[workspace]
projects = ["test"]

```

to the `Project.toml` in the main package. The `pkg>status` of the main project is

```julia-auto
Project AggregatorX v0.1.0
Status `C:\Users\magnusl\local-work\AggregatorX\Project.toml`
  [8bb1440f] DelimitedFiles v1.9.1
⌅ [682c06a0] JSON v0.21.4
  [4076af6c] JuMP v1.29.4
  [b77e0a4c] InteractiveUtils v1.11.0

```

In the `/test` folder there is a `Project.toml`

```julia-auto
[deps]
AggregatorX = "a3088200-1605-46a3-87ce-f04f74214a31"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

```

or running `pkg>status` (after activating ./test)

```julia-auto
(AggregatorX/test) pkg> status
Status `C:\Users\magnusl\local-work\AggregatorX\test\Project.toml`
  [a3088200] AggregatorX v0.1.0 `.`
  [87dc4568] HiGHS v1.21.1
⌅ [682c06a0] JSON v0.21.4
  [4076af6c] JuMP v1.29.4
  [8dfed614] Test v1.11.0

```

But when I run `pkg>test` (after activating main project environment) I get

```julia-auto
ERROR: LoadError: ArgumentError: Package InteractiveUtils not found in current path.
- Run `import Pkg; Pkg.add("InteractiveUtils")` to install the InteractiveUtils package.

```

So it seems like the packages that only are explicitly added in the main project (like InteractiveUtils) can’t be seen from the test (i though that was the idea of the workspace, that this should be possible)? Any ideas why?

---

<div class="post-metadata">

**Author:** ![Magnus\_Lilledahl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magnus_lilledahl/32/51079_2.png) [@Magnus\_Lilledahl](https://discourse.julialang.org/u/Magnus_Lilledahl)\
**Post date:** [February 26, 2026, 6:00pm UTC](https://discourse.julialang.org/t/test-cant-see-packages-in-main-project/135859/2 "2026-02-26T18:00:28Z")

</div>

I think I found the error (shared here in case someone should end up here due to a similarly stupid mistake). I had made a package that was not registered in the general registry so I had initally added it like this to `runtests.jl`:

```julia-auto
include("../src/AggregatorX.jl")
using .AggregatorX

```

as a locally defined module. Later I learned about `add` and `dev` for local git repos and directories, respectively. So when I added the main package (`AggregatorX`) to `Project.toml`of `/test` I guess the dot syntax of `using` messed up something so the deps in the main project weren’t included in the namespace or something (if anyone understands the exact details, please share…). When I removed the `include` statement and simply wrote `using AggregatorX` it worked as expected! 😃

---

<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:** [February 27, 2026, 3:16am UTC](https://discourse.julialang.org/t/test-cant-see-packages-in-main-project/135859/3 "2026-02-27T03:16:30Z")

</div>

> [@Magnus\_Lilledahl](#):
>
> I had made a package that was not registered in the general registry so I had initally added it like this to `runtests.jl`:
> 
> ```julia-auto
> include("../src/AggregatorX.jl")
> using .AggregatorX
> 
> ```
> 
> as a locally defined module.

That is _ **not** _ the right way to do it. You’re not loading the right package, you’re including a file, sidestepping the package manager. Testing non-registered packages is fully supported, otherwise you wouldn’t even be able to test non-registered revision at all.

The thing you need to do when using a workspace is to inform the package manager where to find the desired package, using the [`[sources]` section](https://pkgdocs.julialang.org/v1/toml-files/#The-%5Bsources%5D-section) of the `Project.toml` file. Concretely, in your `test/Project.toml` file add `AggregatorX` as an explicit dependency and then add

```julia-auto
[sources]
AggregatorX = {path = ".."}

```

As a full example, see

> <https://github.com/NumericalEarth/Breeze.jl/blob/038a233d9e471622525d3f97af4bc4f2d84a902e/test/Project.toml#L4-L4>

> <https://github.com/NumericalEarth/Breeze.jl/blob/038a233d9e471622525d3f97af4bc4f2d84a902e/test/Project.toml#L23-L24>

---

<div class="post-metadata">

**Author:** ![Magnus\_Lilledahl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magnus_lilledahl/32/51079_2.png) [@Magnus\_Lilledahl](https://discourse.julialang.org/u/Magnus_Lilledahl)\
**Post date:** [February 27, 2026, 9:59am UTC](https://discourse.julialang.org/t/test-cant-see-packages-in-main-project/135859/4 "2026-02-27T09:59:40Z")

</div>

Thank you for the explanation. I currently have changed it to

```julia-auto
name = "AggregatorX"
uuid = "a3088200-1605-46a3-87ce-f04f74214a31"

...

[workspace]
projects = ["test"]

```

in the main package `Project.toml`

In the `test/Project.toml` I only have

```julia-auto
[deps]
AggregatorX = "a3088200-1605-46a3-87ce-f04f74214a31"
...

```

And I have `using AggregatorX` in `test/runtests.jl`  
This seems to work. As far as I could tell from the most recent (dev) version of the Pkg.jl documentation ([Pkg docs](https://pkgdocs.julialang.org/dev/creating-packages/#adding-tests-to-packages)), this was the current recommended way and that a seperate `[sources]` block in `test/Project.toml` was not needed. Is this correct?

---

<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:** [February 27, 2026, 10:45am UTC](https://discourse.julialang.org/t/test-cant-see-packages-in-main-project/135859/5 "2026-02-27T10:45:20Z")

</div>

If you don’t use the workspace, then the source isn’t necessary but still ok to have it, if you do use the workspace then the source becomes necessary. Workspace is a new feature, but I’d say going forward it’ll probably become more and more useful. The source can be used regardless of whether you have a workspace or not, and it’d actually make activating the test environment easier in all cases (the alternative is to use TestEnv.jl), provided that you use at least Julia v1.11.
