# Suggestion violates cauality

**URL:** <https://discourse.julialang.org/t/suggestion-violates-cauality/62958>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [June 15, 2021, 3:56pm UTC](https://discourse.julialang.org/t/suggestion-violates-cauality/62958 "2021-06-15T15:56:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Nahabedian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mark_nahabedian/32/16562_2.png) [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Post date:** [June 15, 2021, 3:56pm UTC](https://discourse.julialang.org/t/suggestion-violates-cauality/62958/1 "2021-06-15T15:56:57Z")

</div>

Anyone seen this before:

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

```

Any ideas what I might have done to cause it?

I’m using a custom workspace because I’m relying on a change to NativeSVG that hasn’t been promoted yet and because of some trouble I had with matching compatible versions of UnitfulCurrency with Unitful.

My code can be found at

> **[GitHub - MarkNahabedian/PanelCutting.jl: Tool for optimizing how to cut down...](https://github.com/MarkNahabedian/PanelCutting.jl)**
>
> Tool for optimizing how to cut down sheet goods (e.g. plywood) to specified sizes. - GitHub - MarkNahabedian/PanelCutting.jl: Tool for optimizing how to cut down sheet goods (e.g. plywood) to speci...

My only local change from GitHub is to use an absolute path in the Pkg.activate call at the beginning of test/runtests.jl.

Also, any advice about a more streamlined way to test my package would be appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![Erasmo98](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erasmo98/32/26098_2.png) [@Erasmo98](https://discourse.julialang.org/u/Erasmo98)\
**Post date:** [June 16, 2021, 4:40am UTC](https://discourse.julialang.org/t/suggestion-violates-cauality/62958/2 "2021-06-16T04:40:15Z")

</div>

A similar problem is discussed in this topic [Problem with Pkg: cannot be found in current path](https://discourse.julialang.org/t/problem-with-pkg-cannot-be-found-in-current-path/26492).

---

<div class="post-metadata">

**Author:** ![Mark\_Nahabedian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mark_nahabedian/32/16562_2.png) [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Post date:** [June 16, 2021, 1:58pm UTC](https://discourse.julialang.org/t/suggestion-violates-cauality/62958/3 "2021-06-16T13:58:31Z")

</div>

Thanks. Unfortunately, I have no clue what the value of LOAD\_PATH is when the error occurs since it happens during Pkg.test:

```julia
using Pkg
Pkg.activate("c:/Users/Mark Nahabedian/.julia/dev/PanelCutting")
  Activating environment at `c:\Users\Mark Nahabedian\.julia\dev\PanelCutting\Project.toml`
using PanelCutting
LOAD_PATH
3-element Vector{String}:
 "@"
 "@v#.#"
 "@stdlib"
Pkg.test("PanelCutting")
     Testing PanelCutting
      Status `C:\Users\Mark Nahabedian\AppData\Local\Temp\jl_RWQoyO\Project.toml`
...
33 dependencies successfully precompiled in 86 seconds (94 already precompiled)
     Testing Running tests...
ERROR: LoadError: ArgumentError: Package Pkg not found in current path:
- Run `import Pkg; Pkg.add("Pkg")` to install the Pkg package.

```

(sorry for the lack of prompts and other boiler plate. I’m running from an emacs shell and prompts, etc. don’t seem to get displayed).

Unfortunately the temporary workspace directory that gets constructed for the test gets deleted before I can examine it.

Am I correct in assuming that Pkg.test (or maybe Test.runtests) starts a separate process for testing?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [June 16, 2021, 4:10pm UTC](https://discourse.julialang.org/t/suggestion-violates-cauality/62958/4 "2021-06-16T16:10:14Z")

</div>

I’m not entirely sure what you’re doing here, but you shouldn’t need to `activate` in your tests. Instead, get the package manager itself to handle that using one of the two methods listed here: [**Creating Packages** : Adding tests to the package](https://pkgdocs.julialang.org/v1.6/creating-packages/#Adding-tests-to-the-package).

Note that when you load a package it has a slightly more restrictive view of the world than when you are working with it interactively. Thus, yes, if a package uses `Pkg` you need to add `Pkg` to its project. This error message when this happens is different than what you’re seeing, though, so I’m not fully sure… But regardless I think this is a bit of a red herring — I’d try to avoid using Pkg.activate in the first place.

---

<div class="post-metadata">

**Author:** ![Mark\_Nahabedian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mark_nahabedian/32/16562_2.png) [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Post date:** [June 16, 2021, 6:30pm UTC](https://discourse.julialang.org/t/suggestion-violates-cauality/62958/5 "2021-06-16T18:30:49Z")

</div>

Thans for referring me to that description of the pre and post Julia 1.2 ways of describing test dependencies.

I’m using julia version 1.6.0.

I’m going with the pre-1.2 single Project.toml approach for now. This got all of my tests to pass.

I stilll have some questions though:

In the post Julia 1.2 structure, how can one ensure that the test workspace is using the same package versions as the package being tested?

In the pre Julia 1.2 structue, why do I need to duplicate dependencies from the `deps` section of my package’s Project.toml file in the `extras` section of that file? To my mind the word “extra” suggests that it is for dependencies beyond those of the package itself.

Also, is there a way to run my package’s tests without activating my package’s workspace first? When I don’t it complaiins

```julia
ERROR: LoadError: LoadError: ArgumentError: Package PanelCutting does not have Markdown in its dependencies

```

but Mardown is listed as a dependency in my Project.toml file.
