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

Project dependencies setup (TestJive.jl example does not work) #41

Closed
tisztamo opened this issue Aug 4, 2021 · 6 comments
Closed

Project dependencies setup (TestJive.jl example does not work) #41

tisztamo opened this issue Aug 4, 2021 · 6 comments

Comments

@tisztamo
Copy link

tisztamo commented Aug 4, 2021

Trying to execute runtests.jl as a script, but it is not clear how I can set up the project environment so that Jive and my test dependencies wil be available.

The examples show how this should be done, but they are not working with Julia 1.6:

% git clone https://github.com/wookay/TestJive.jl
Cloning into 'TestJive.jl'...
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 23 (delta 0), reused 5 (delta 0), pack-reused 17
Unpacking objects: 100% (23/23), done.
% cd TestJive.jl/test
% julia runtests.jl test1
ERROR: LoadError: ArgumentError: Package Jive not found in current path:
- Run `import Pkg; Pkg.add("Jive")` to install the Jive package.

julia --project=. test/runtests.jl throws the same.

What is the way to go?

@wookay
Copy link
Owner

wookay commented Aug 5, 2021

you could add Jive pkg.

julia -e 'using Pkg; Pkg.add("Jive")'

or you can activate . that project.

$ julia --project=.
julia>

press ] key

(TestJive) pkg>

(TestJive) pkg> activate .
  Activating environment at `~/work/TestJive.jl/Project.toml`

(TestJive) pkg> test

http://pkgdocs.julialang.org/v1/environments/#Using-someone-else's-project

@tisztamo
Copy link
Author

tisztamo commented Aug 6, 2021

Thank you for replying!

Maybe my original report was not detailed enough: I am using the pkg> test method for more than a year. My goal was here to run tests selectively, as described in the docs, and the examples in the docs start testing by running runtests.jl as a script, e.g.:

~/.julia/dev/Jive/test $ julia runtests.jl jive/If

(Note that in this example there is no --project, but I definitely need it)

It is clear that adding Jive as a normal dependency to the package helps, but I want to avoid that, because that will lead to installing Jive (update: and other test helpers I am using) in every project using my package, making my package a heavier dependency.

Jive is currently added as an "extra" dependency to the Project.toml, but a separate Project.toml in the test dir is also a possibility. What I do not see: how directly starting runtests.jl will work in this case, or if there is a way to run only specific tests while executing pkg> test.

Thanks in advance!

@tisztamo
Copy link
Author

tisztamo commented Aug 6, 2021

Thanks, this way of calling seems to open the way to filter tests by using the test_args argument.

However,

julia --project=. -e 'using Pkg; Pkg.test(; test_args=["test1"])'

still runs both tests, not clear why. (This way of calling sets the ARGS, I am using it in another package without a test helper: https://github.com/tisztamo/Plugins.jl/blob/2ad710f707237426dbfc1d61c6e13ab625c1d05d/test/runtests.jl#L6 )

@wookay
Copy link
Owner

wookay commented Aug 6, 2021

oh. I just bump up the Jive version.
[ba5e3d4b] Jive v0.2.18

please to update the Pkg registry.

julia -e 'using Pkg; Pkg.update()'

@tisztamo
Copy link
Author

tisztamo commented Aug 9, 2021

Thank you very much, it is working now!

@tisztamo tisztamo closed this as completed Aug 9, 2021
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

No branches or pull requests

2 participants