Skip to content

Improve docs about relative paths - #165

Merged
christiangnrd merged 4 commits into
JuliaTesting:mainfrom
SoongNoonien:main
Aug 15, 2026
Merged

Improve docs about relative paths#165
christiangnrd merged 4 commits into
JuliaTesting:mainfrom
SoongNoonien:main

Conversation

@SoongNoonien

Copy link
Copy Markdown
Contributor

I'm trying to use this package after attending today’s talk at JuliaCon and ran into a minor issue caused by loading files via relative paths. While this probably was totally my own fault, I think that this change might prevent others from having the same problem.

Basically the issue was that when using testsuite = find_tests(pwd()), one can't simply run the runtests.jl script from the base directory, since this will include all .jl files, even those in src.

Comment thread docs/src/index.md Outdated
Comment thread docs/src/index.md Outdated
```

!!! note
When using relative paths in `runtests.jl`, remember to run the script in the correct directory.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

While this is correct, I don't think people should use stuff like pwd in the first place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree, but pwd() was suggested before and it is still explained how to define a custom testsuite with relative paths: https://juliatesting.github.io/ParallelTestRunner.jl/stable/advanced/#Customizing-the-test-suite

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, as I said above, switching pwd to dir is a good call! I don't think we should encourage pwd, because then causes this. The solution is just not to rely on pwd, not to be in the right directory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, then how do you suggest to update the cited part of the docs? Should include("basic.jl") be replaced by something like include(joinpath(@__DIR__, "basic.jl"))?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yup! If there are other references to pwd, should be all changed to DIR.

Unfortunately

testsuite::Dict{String,Expr} = find_tests(pwd()),
needs to remain, because otherwise the default value of the argument would point to the test directory of ParallelTestRunner.jl itself 😞

@giordano

Copy link
Copy Markdown
Collaborator

Can you please also change

testsuite = find_tests(pwd())
? Hopefully we're done with this.

@christiangnrd

Copy link
Copy Markdown
Collaborator

Thank you for your contribution!

@christiangnrd
christiangnrd merged commit fbe1296 into JuliaTesting:main Aug 15, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants