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

interface for adding a test dependency #480

Open
tpapp opened this issue Jul 9, 2018 · 12 comments
Open

interface for adding a test dependency #480

tpapp opened this issue Jul 9, 2018 · 12 comments
Labels
feature REPL sandbox New test/Project.toml testing framework

Comments

@tpapp
Copy link
Contributor

tpapp commented Jul 9, 2018

It would be great to have the functionality of #340 exposed in the interactive interface, so that one does not have to manually edit the Project.toml. Eg something like

pkg> add targets.test SomePackage
pkg> rm targets.test SomePackage

or simply add test.

@IainNZ
Copy link
Member

IainNZ commented Jul 17, 2018

I'd be interested in tackling this. Is the idea to add it as a PR for this repo, then it gets copied into julia main repo?

@StefanKarpinski
Copy link
Member

Right, package features are developed here and then upstreamed (usually by @KristofferC) into the Julia main repo stdlib/Pkg directory. To load a development copy, you'll want to comment out the uuid = entry in the Project.toml file and then run julia --project from there and do import Pkg, although for some reason that has started to give me a conflicting binding error. @JeffBezanson, did you change something that causes Main.Pkg to be definitively resolved to stdlib/Pkg?

@StefanKarpinski
Copy link
Member

@IainNZ, if you haven't started on this yet, you may want to hold off for a bit... I may change things that will conflict significantly with anything you do here. I'm trying to implement #165 but it's leading to a bit of design rethought on targets, alternatives, etc.

@IainNZ
Copy link
Member

IainNZ commented Jul 18, 2018

Haven't started yet - will follow that. Got ~10 days of down time so no rush.

@tkf
Copy link
Member

tkf commented Jul 22, 2018

Related to this, is there (or are you planning to implement) an interface for activating test environment?

Let's say I have JSON in my targets.test.deps but not in deps:

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"

[targets.test.deps]
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"

Then how do I debug my tests? If I do include("test/runtests.jl") in REPL started with julia --project it says that ArgumentError: Package JSON not found in current path. Checked with:

julia> versioninfo()
Julia Version 0.7.0-beta2.48
Commit c6a949a9c3 (2018-07-19 18:28 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)

Or is there something wrong in my workflow? Are there better ways to run tests in REPL namespace (i.e., not in subprocess via pkg> test)?

@KristofferC
Copy link
Member

Yes, this is a bit annoying. You could just comment out the [targets.test.deps] and those should then apply to [deps]. @StefanKarpinski has another design idea where all packages are put under [deps] which might help with this.

@StefanKarpinski
Copy link
Member

Yes, I'm working on that and should be done with it today. In this design, targets is just a way of choosing subsets of all the dependencies. So far it seems like a cleaner design in general.

@tpapp
Copy link
Contributor Author

tpapp commented Jul 26, 2018

If #531 is the solution for the Project.toml file, then I could imagine

pkg> add test=SomePackage

for

  1. adding SomePackage to [extras], if not already present,
  2. pushing SomePackage to test = in [extras]

@StefanKarpinski
Copy link
Member

Maybe pkg> add SomePackage --target=test?

@cossio
Copy link
Contributor

cossio commented Aug 30, 2018

Or just pkg> add SomePackage target=test (without --)? Similar to how you add keyword arguments to macros in proper Julia.

@StefanKarpinski
Copy link
Member

We may want to do some design work on the pkg REPL syntax. It's grown somewhat organically and now that we have some more experience with what needs to be supported, we can think about it a bit more thoroughly. Since it's an interactive mode, we can make breaking changes.

@anandijain
Copy link

bump on this, it still feels so dang crude to have to manually edit the toml to add the Test package as a test dep when starting a fresh project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature REPL sandbox New test/Project.toml testing framework
Projects
None yet
Development

No branches or pull requests

8 participants