cabal test should provide information about test dependencies #1665

Open
puffnfresh opened this Issue Feb 3, 2014 · 11 comments

Comments

Projects
None yet
8 participants

Running cabal test without test dependencies installed gives a nasty error:

Re-configuring with test suites enabled. If this fails, please run configure
manually.
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: program-0.1 (user goal)
rejecting: program-0.1:!test (global constraint requires opposite flag
selection)
trying: program-0.1:*test
next goal: tasty (dependency of program-0.1:*test)
fail (unknown package: tasty)
Dependency tree exhaustively searched.

The answer is to install the missing dependencies using cabal install --enable-tests --only-dependencies. Is it possible for us to add a useful message for when test dependencies are missing?

fail (unknown package: tasty)
Dependency tree exhaustively searched.
You might need to run: cabal install --enable-tests --only-dependencies
Member

cartazio commented Feb 3, 2014

heres a strawman design, if cabal test fails at the package selection/configure step, because a dependency wasn't installed (vs the other common one of "you have an incompatible package version already installed"), to provide an error like

it appears that at least one dependency of the test suite is missing.
Please install these dependencies and try again. 
You can install missing test suite dependencies individually, 
or via cabal --enable-test --only-dependencies

however, i'm not sure if --enable-tests always works to install those deps... though I could be wrong. (or at least i never could repro the problem when i had the time to :)

Member

23Skidoo commented Feb 3, 2014

Looks like a duplicate of #1100.

@23Skidoo that'd solve the problem. Would love to close in favour of that, if it's going to happen soon!

+1

Owner

tibbe commented Feb 3, 2014

cabal test (and bench, run, etc) in a sandbox should just imply the needed dependency installation step. We cannot really do this outside sandboxes today, as we might screw up the user's installation.

Member

cartazio commented Feb 3, 2014

@tibbe agreed. Outside of a sandbox, might a clearer "you may need to install X Y and Z" error message help?

@tibbe will cabal test always imply cabal install --only-dependencies or only if building fails because of missing dependencies?

Owner

tibbe commented Feb 4, 2014

@puffnfresh Always, although we should avoid unnecessary rebuilds. cabal test should just "do what I mean". Currently cabal requires the user to type in lots of boilerplate commands that the computer could figure out just fine.

afcowie commented Apr 23, 2014

While solving the underlying problem in sandboxes will be cool, at present the error message occurs both in sandboxes and not. Something like the help text @puffnfresh or @cartazio suggested would have saved us a few hours this afternoon.

AfC

Owner

tibbe commented Apr 23, 2014

If someone is willing to implement the "outside the sandbox better error message" option, please go ahead.

ttuegel added this to the _|_ milestone Apr 23, 2015

Contributor

ezyang commented Aug 16, 2016

This ticket will be obsoleted by nix-local-build. (But I'm not closing it yet because it's still real.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment