Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine test specific dependencies #52477

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions doc/src/tutorials/creating-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,15 @@ test-specific dependencies, are available, see below.

### Test-specific dependencies

There are two ways of adding test-specific dependencies (dependencies that are not dependencies of the package but
There are two ways of adding test-specific dependencies (dependencies that are not dependencies of the package but
will still be available to load when the package is tested). If no `test/Project.toml` exists Pkg will default to
use the `target` based test specific dependencies.
use the `target` based test specific dependencies.
ViralBShah marked this conversation as resolved.
Show resolved Hide resolved

#### `target` based test specific dependencies

!!! compat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect this compat notice after the explanation of what the target method does

Copy link
Contributor Author

@freemin7 freemin7 Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is directly related to the decision what functionality to choose, i could see that compat block being useful before further explanations.
That said. I don't care.

This older method of adding test-specific dependencies will be supported for all Julia 1.X releases.
ViralBShah marked this conversation as resolved.
Show resolved Hide resolved

Using this method of adding test-specific dependencies, the packages are added under an `[extras]` section and to a test target.
E.g. to add `Markdown` and `Test` as test dependencies, add the following to the projects `Project.toml` file:

Expand All @@ -297,7 +297,7 @@ test = ["Markdown", "Test"]
```

During testing the file `test/runtests.jl` will be executed with all dependencies from the `Project.toml` and the test dependencies
loaded. This special dependency handling is done during a `Pkg.test` call and doesn't happen if `runtest.jl` is executed directly.
loaded. This special dependency handling is done during a `Pkg.test` call and doesn't happen if `runtest.jl` is executed directly.

Note that the only supported targets are `test` and `build`, the latter of which (not recommended) can be used
for any `deps/build.jl` scripts. This `target` based approach can't be used for other uses such as building
Expand Down Expand Up @@ -340,7 +340,7 @@ julia> write("test/runtests.jl",
@test 1 == 1
""");

(test) pkg> activate .
(test) pkg> activate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removed does not appear to be "white spaces".


(HelloWorld) pkg> test
Testing HelloWorld
Expand All @@ -352,7 +352,7 @@ julia> write("test/runtests.jl",
[d8327f2a] + HelloWorld v0.1.0 [`~/.julia/dev/Pkg/HelloWorld`]
Testing HelloWorld tests passed```
```

## Compatibility on dependencies

Every dependency should in general have a compatibility constraint on it.
Expand Down