# How to use workspaces to test?

**URL:** <https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670>\
**Category:** General Usage\
**Created:** [November 5, 2025, 9:09am UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670 "2025-11-05T09:09:56Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![phma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/phma/32/6576_2.png) [@phma](https://discourse.julialang.org/u/phma)\
**Post date:** [December 5, 2025, 6:35pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/21 "2025-12-05T18:35:21Z")

</div>

That runs the tests. I asked if I want to run functions in `test`.

```julia-auto
function testInvalidCodeword(cw::Codeword)
  dec,bits,codeBits,upsideDown=decode(cw,false)
  bits<0
end

function testInvalidCodeword(cw::Vector{<:Integer})
  testInvalidCodeword(Codeword(cw))
end

@test testInvalidCodeword([0x1f,0x54,0x7f,0x7f,0x55,0])
# This has a run of 16 bits. Real Mumzel has no run longer than 11.
@test testInvalidCodeword([0x46,0x36,0x17,0x4e,0x2c,0])
# partB is 249; the maximum valid is 223, except for syncwords.
@test testInvalidCodeword([0x16,0x69,0x4a,0x6d,0x12,1])
# This is row 265 of the 270 rows of pattern 43425, but only 256 rows are used.

```

This code is in `runtests.jl`. If I’m writing a new test, I’d like to call `testInvalidCodeword` interactively with various codewords before I add a test to `runtests.jl`. How do I do that?

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [December 5, 2025, 6:36pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/22 "2025-12-05T18:36:00Z")

</div>

Just open a Julia REPL in your `test` environment and run that file line by line?

---

<div class="post-metadata">

**Author:** ![moble](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moble/32/23535_2.png) [@moble](https://discourse.julialang.org/u/moble)\
**Post date:** [December 5, 2025, 8:05pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/23 "2025-12-05T20:05:41Z")

</div>

> [@phma](#):
>
> So if I want to run functions in `test` from the REPL, instead of running `]test`, I have to start Julia in the test directory? I can’t start it in the main project directory and then `activate test`?

> [@phma](#):
>
> This code is in `runtests.jl`. If I’m writing a new test, I’d like to call `testInvalidCodeword` interactively with various codewords before I add a test to `runtests.jl`. How do I do that?

I think we’re a bit confused because these two statements from your two comments sound contradictory. You said “instead of running `]test`”, which is what you would normally do to run those `@test` statements in your `runtests.jl`. So I think most of us read that and think you must want to run those `@test` statements somehow (and there are indeed multiple ways). But your second comment says that’s not what you want.

If you don’t want to run those `@test` statements, but do want to use `testInvalidCodeword`, you somehow need to include the code that defines those functions. But you probably don’t want to just `include("runtests.jl")`, because that will run the `@test`s. You’ll probably want to extract the function definitions into some other file, then include that file into `runtests.jl` so that your tests will still run, and include that file when you’re calling the functions interactively.

I don’t know where `decode` and `Codeword` are defined, but if they’re in a package, then whatever environment has that package will need to be active. If it’s your main package, you could run it from your package’s environment; if it’s only in your `test` environment, you’ll need to activate your `test` environment.

Most of this is the same as it was before workspaces came into being. (See also TestEnv.jl.)

---

<div class="post-metadata">

**Author:** ![phma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/phma/32/6576_2.png) [@phma](https://discourse.julialang.org/u/phma)\
**Post date:** [December 5, 2025, 9:14pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/24 "2025-12-05T21:14:17Z")

</div>

`decode` and `Codeword` are defined in the main package. `testInvalidCodeword` is defined in the `test` workspace. I’d like to run `testInvalidCodeword` from the REPL, but the only way I know to run a function in `runtests.jl` is to type `test` in `Pkg`, which recompiles the whole package. If I have to run all the tests to call `testInvalidCodeword` from the REPL, that’s okay; they don’t take long. But I don’t yet know any way to call functions defined in the `test` workspace from the REPL.

---

<div class="post-metadata">

**Author:** ![moble](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moble/32/23535_2.png) [@moble](https://discourse.julialang.org/u/moble)\
**Post date:** [December 5, 2025, 9:33pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/25 "2025-12-05T21:33:31Z")

</div>

> [@phma](#):
>
> I don’t yet know any way to call functions defined in the `test` workspace from the REPL.

I would argue that those functions are not defined “in the `test` workspace” at all; they are defined in the `runtests.jl` file (currently). Basically, what happens when you do `]test` is that Julia’s Pkg manager just includes the `tests/runtests.jl` file. The fact that `]test` does some environment weirdness is separate from the fact that you happened to define your functions in that file.

So if you want to use those functions in your REPL session, _ **you need to define them** _. You need to tell your REPL session what they are; just putting them somewhere in the environment won’t do that. That’s why I suggested putting them in a separate file and calling the `include` function on that file from your REPL.

You might also be interested in [TestItems](https://www.julia-vscode.org/docs/stable/userguide/testitems/).

---

<div class="post-metadata">

**Author:** ![phma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/phma/32/6576_2.png) [@phma](https://discourse.julialang.org/u/phma)\
**Post date:** [December 7, 2025, 8:56am UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/26 "2025-12-07T08:56:35Z")

</div>

What’s the main file in a workspace? If I run `julia --project -t auto` in the `Foo` repo, then `using Foo`, it loads `Foo/src/Foo.jl`. If I then `activate test`, what `using` command do I give, and what file in `Foo/test/` does it load?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 7, 2025, 10:01am UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/27 "2025-12-07T10:01:37Z")

</div>

This sounds like some kind of confusion. The reason `using Foo` loads `src/Foo.jl` in that scenario is that you have activated an environment that defines a package called `Foo` (because `Project.toml` contains a name, with value `Foo`, and a uuid) and `src/Foo.jl` is where the package loading looks for the source code.

When you activate the `test` environment, that won’t be a package environment and there’s no mechanism by which `using X` would load something in the `test` directory just because that contains your activated environment.

---

<div class="post-metadata">

**Author:** ![LeePhillips](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leephillips/32/205514_2.png) [@LeePhillips](https://discourse.julialang.org/u/LeePhillips)\
**Post date:** [December 7, 2025, 8:20pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/28 "2025-12-07T20:20:46Z")

</div>

The article at [Julia 1.12 brings progress on standalone binaries and more [LWN.net]](https://lwn.net/Articles/1044280/) contains a section on workspaces and shows how to set them up.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 13, 2025, 11:39am UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/29 "2025-12-13T11:39:58Z")

</div>

> [@hexaeder](#):
>
> Generally, older Julia version will just ignore sections they don’t understand.

I found that 1.11 occasionally rearranges a `version` on top, as in

```toml
name = "Whatever"
uuid = "some-UUID"
authors = ["Tamás K. Papp <tkpapp@gmail.com>"]
version = "0.1.0"

[workspace]
projects = ["test", "debug"]

```

to

```toml
[workspace]
projects = ["test", "debug"]
version = "0.1.0"

```

at the bottom, making 1.12 baffled.

(I am currently running a project where I use 1.11 for the estimation which needs Enzyme, which is still catching up to 1.12, and 1.12 for everything else; otherwise it works fine, with version-specific manifests. I am in workflow heaven. 🌴)

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [March 16, 2026, 3:53pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/30 "2026-03-16T15:53:39Z")

</div>

I have a registered project which I am switching to Workspaces: Just experimenting right now. It runs OK under the current (v1.12) as well LTS (v1.10) Julia. However on running the test suite under LTS I get the (expected) error:  
`ERROR: FOO is a direct dependency, but does not appear in the manifest.`

What is the proper way to handle the situation, locally and on CI server?

P.S. I’ve now added `Manifest-v1.10.toml` to the test environment and updated both the “main” project and the test environment. Now the tests are OK, at least locally. I do not know exactly what it was, it could be the project environment was initially not properly resolved under Julia v1.10.

Still, the question: As I am probably not the first one to handle the issue, what is the “canonical” way to do it?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 16, 2026, 10:16pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/31 "2026-03-16T22:16:03Z")

</div>

I use a simple, 600 lines script to instantiate a project with different workspaces for different Julia versions:

> <https://github.com/OpenSourceAWE/KiteModels.jl/blob/main/bin/install>

It is a pain.

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [March 16, 2026, 10:42pm UTC](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670/32 "2026-03-16T22:42:26Z")

</div>

> [@Eben60](#):
>
> I’ve now added `Manifest-v1.10.toml` to the test environment

Actually I’ve tested it on CI too, and there were no problems. The Manifests are not checked in anyway, there is Project.toml in the test environment, under Julia v1.10 the `[workspace]` section is ignored, so basically everything is just as it was before.

Locally, under v1.12 there is one Workspace’s consolidated `Manifest-v1.12.toml` in the root, whereas under v1.10 there is a `Manifest-v1.10.toml` in each (sub-) project. In each case the manifests for other versions are ignored.

[Previous page](https://discourse.julialang.org/t/how-to-use-workspaces-to-test/133670.md?page=1)
