Ghcide: Test dependencies not being loaded, reported as errors

Created on 13 Dec 2019  路  8Comments  路  Source: haskell/ghcide

This problem with test dependencies is still alive, I'm afraid. I have been encountering the same problem as originally discussed in #49 (but that issue got derailed into talking about custom pre-processors).

image

This pops up when I happen to open a source file from the test suite. The main library & executable are building fine, but a module with tests in it fails to proceed with that error, which is unfortunate.

This is with ghcide 0.0.5 built from source as released earlier today.

I'll attach the _.cabal_ file for a project that exhibits this behaviour momentarily.

bug setup

Most helpful comment

We will shortly do a new release of hie-bios but ghcide still has to support the new features which requires the work that @ndmitchell alludes to in https://github.com/digital-asset/ghcide/issues/239#issuecomment-565382434

All 8 comments

Portion of _.cabal_ file which results in this error:

test-suite check
  type: exitcode-stdio-1.0
  main-is: TestSuite.hs
  other-modules:
      CheckAbstractSyntax
      CheckSkeletonParser
      CheckQuantityBehaviour
      CheckTranslationStage
      ExampleProcedure
  hs-source-dirs:
      tests
  ghc-options: -Wall -Wwarn -fwarn-tabs -threaded -dynamic
  build-depends:
      base >=4.11 && <5
    , core-data >=0.2.1
    , core-program >=0.2.3
    , core-text >=0.2.2.6
    , dlist
    , free
    , hspec
    , ivar-simple
    , megaparsec
    , parser-combinators
    , prettyprinter
    , prettyprinter-ansi-terminal
    , technique
    , text
  default-language: Haskell2010

Note presence of hspec in dependency list, which puts me at a bit of a loss.

Full source derived from this package.yaml

@afcowie yep, it's the big disagreement between hie-bios vs ghcide - do you put everything in one session, or create multiple sessions. I think we've agreed to try some halfway house (one session, different flags) which might be the best of both worlds, but no one has done the implementation work yet.

just ran into this when setting up ghcide for work. is there a workaround?

EDIT: haven't looked at the hie-bios documentation much. i'll take a look at that

EDIT2: looks like the features needed to workaround aren't released. i think i'll have to build hie-bios from source, but i'm not sure it's (on master) even currently compatible with ghcide

We will shortly do a new release of hie-bios but ghcide still has to support the new features which requires the work that @ndmitchell alludes to in https://github.com/digital-asset/ghcide/issues/239#issuecomment-565382434

@mpickering alright, thank you

as a workaround: you can remove the dependancy of the tests on the library and add the library sources to the test sources.

You then need to point the hie-bios cradle to the test package

example: https://github.com/ilyakooo0/isoparsec/pull/21

or this can be a special target which includes all of the sources if you want your CI to still test code as a separate library, rather than importing sources themselves

lastest ghcide should work with that, @istathar feel free to reopen if it is not thecase

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fendor picture fendor  路  7Comments

googleson78 picture googleson78  路  9Comments

domenkozar picture domenkozar  路  3Comments

moodmosaic picture moodmosaic  路  3Comments

anka-213 picture anka-213  路  5Comments