Description
@ulysses4ever's exec summary:
-
this issue (and its variations) has been discussed on multiple occasions (new-test should imply --enable-tests #5079, 'cabal new-build test:test-suite' doesn't force tests to be enabled. #3923)
-
a desirable converging point in the design space seems to be, as of now (as put by grayjay):
By default,
cabal build
would solve for tests but not build them, andcabal test
would solve for tests and build them -
the main counterpoint to the idea above (as put by fgaz):
It could happen that there are no build plans with tests enabled but there are with tests disabled
-
it feels like we get a better UX if we follow the idea still, and the answer to the counterpoint (as put by Mikolaj):
[In the case of no plan including tests or benchmarks exists,] the user can manually disable tests or benchmarks
-
anecdotally, many power users already put
tests: True
in their global config and deal with the above mentioned problem on the case by case basis; we just enshrine this practice in the default; -
our best hope for implementing something like that is, currently, [WIP] Only buildable tests #7829 but it looks like it needs a new champion...
Describe the bug
I'm dog-fooding current dev cabal from master branch.
Solver is not cooperating. Cabal says "solver picked a plan that does not include the test suites" despite there being such a plan, which can be seen when forcing with 'tests: True'.
To Reproduce
Clone
Mikolaj/mostly-harmless@3feb586
Run the following (it seems, a fresh package store is not required after all)
cabal test -w ghc-9.2.1
It shows
Resolving dependencies...
Error: cabal: Cannot test the package mostly-harmless-0.1.0.0 because none of
the components are available to build: the test suite 'mostly-harmless-test'
is not available because the solver picked a plan that does not include the
test suites, perhaps because no such plan exists. To see the error message
explaining the problems with such plans, force the solver to include the test
suites for all packages, by adding the line 'tests: True' to the
'cabal.project.local' file.
but cabal build -w ghc-9.2.1 --enable-tests
(as well as cabal test -w ghc-9.2.1
with 'tests: True' in cabal.project.local
) goes through fine and tests run. However, after removing cabal.project.local
, cabal test -w ghc-9.2.1
fails again the same.
The same attempts with ghc-8.10.7 work fine.
Expected behavior
The solver should pick the right plan without forcing. Forcing would ideally be used only to show the error that prevents the solver from finding a plan. That's the assumption under which @gelisam and me operated in #7834 and related tickets. Now it's all put into question.