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

Building tests via cabal fails when adding dependencies hspec and trifecta #73

Closed
freeman42x opened this issue Apr 3, 2018 · 4 comments

Comments

@freeman42x
Copy link

To reproduce:

checkout unexpected-bug-example branch from this fork: https://github.com/razvan-panda/parsers/tree/unexpected-bug-example

cabal sandbox init
cabal install --only-dependencies --enable-tests

Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: trifecta (dependency of parsers-0.12.8:*test)
rejecting: trifecta-1.7.1.1/installed-A22... (package is broken)
rejecting: trifecta-1.7.1.1, trifecta-1.7.1, trifecta-1.7, trifecta-1.6.2.1,
trifecta-1.6.2, trifecta-1.6.1 (cyclic dependencies; conflict set: parsers,
trifecta)
rejecting: trifecta-1.6 (conflict: base==4.10.1.0/installed-4.1..., trifecta
=> base>=4.4 && <4.9.1)
rejecting: trifecta-1.5.2, trifecta-1.5.1.3, trifecta-1.5.1.2,
trifecta-1.5.1.1, trifecta-1.5.1, trifecta-1.5, trifecta-1.4.3,
trifecta-1.4.2, trifecta-1.4.1 (cyclic dependencies; conflict set: parsers,
trifecta)
rejecting: trifecta-1.4 (conflict: base==4.10.1.0/installed-4.1..., trifecta
=> base>=4.4 && <4.7)
rejecting: trifecta-1.2.1.1, trifecta-1.2.1 (cyclic dependencies; conflict
set: parsers, trifecta)
rejecting: trifecta-1.2 (conflict: base==4.10.1.0/installed-4.1..., trifecta
=> base<0)
rejecting: trifecta-1.1, trifecta-1.0 (cyclic dependencies; conflict set:
parsers, trifecta)
trying: trifecta-0.53
trying: template-haskell-2.12.0.0/installed-2.1... (dependency of
tagged-0.8.5)
next goal: pretty (dependency of template-haskell-2.12.0.0/installed-2.1...)
rejecting: pretty-1.1.3.3/installed-1.1... (conflict: pretty =>
deepseq==1.4.3.0/installed-1.4..., trifecta => deepseq>=1.2.0.1 && <1.4)
rejecting: pretty-1.1.3.6, pretty-1.1.3.5, pretty-1.1.3.4, pretty-1.1.3.3,
pretty-1.1.3.2, pretty-1.1.3.1, pretty-1.1.2.1, pretty-1.1.2.0,
pretty-1.1.1.3, pretty-1.1.1.2, pretty-1.1.1.1, pretty-1.1.1.0,
pretty-1.1.0.0, pretty-1.0.1.2, pretty-1.0.1.1, pretty-1.0.1.0, pretty-1.0.0.0
(conflict: template-haskell => pretty==1.1.3.3/installed-1.1...)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: terminfo, trifecta, base, parsers,
parsers-0.12.8:test
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

Building using stack test works fine.

@phadej
Copy link
Contributor

phadej commented Apr 3, 2018

trifecta depends on parsers, so currently that kind of setup doesn't work.

rejecting: trifecta-1.7.1.1, trifecta-1.7.1, trifecta-1.7, trifecta-1.6.2.1,
trifecta-1.6.2, trifecta-1.6.1 (cyclic dependencies; conflict set: parsers,
trifecta)

With sandboxes you could cabal install, cabal install trifecta, and then reconfigure parsers with --enable-tests. That what stack does under the hood.

@freeman42x
Copy link
Author

freeman42x commented Apr 3, 2018

@phadej I did something like that earlier - since it mentioned the package was broken - with --force-reinstalls and then everything built.

Isn't there any way to get cabal to reliably run the tests on cabal test? Does it have to be done manually like this?

@RyanGlScott
Copy link
Collaborator

Let me ask this: why are you trying to put a downstream dependency of trifecta directly into parsers' test suite? Due to haskell/cabal#1575, that's just asking for trouble.

As @phadej notes in #73 (comment), you can sometimes make this work by manually installing the dependencies before configuring your project. But even then it's not always guaranteed to work, as #72 (and bos/vector-binary-instances#8) demonstrate. Cyclic dependencies is simply not a tenable approach at the moment.

I don't know what your intentions are with this project, but my recommendation is to separate the test suite into a separate .cabal file, like what was done in ekmett/transformers-compat#33 and haskell/primitive#90, and have a single cabal.project/stack.yaml file that includes both parsers.cabal and parsers-tests.cabal as projects. That way, you'll be able to build trifecta on top of your local copy of parsers, and you won't run into cyclic dependencies.

In any case, this is not a bug with parsers itself, so closing.

@freeman42x
Copy link
Author

@RyanGlScott My intention with the project was to provide some tests/examples for using parsers, and those tests depended on trifecta also. It is unfortunate that in this scenario tests do not work with cabal but work fine with stack.

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

3 participants