Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

cabal test should provide information about test dependencies #1665

Open
puffnfresh opened this Issue · 10 comments

7 participants

@puffnfresh

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
@cartazio

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 :)

@23Skidoo
Collaborator

Looks like a duplicate of #1100.

@puffnfresh

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

@tibbe
Owner

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.

@cartazio

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

@puffnfresh

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

@tibbe
Owner

@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

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

@tibbe
Owner

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

@ttuegel ttuegel added this to the _|_ milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.