hackage-server icon indicating copy to clipboard operation
hackage-server copied to clipboard

`doctest`s need `--write-ghc-environment-files=always`

Open andreasabel opened this issue 2 years ago • 6 comments

See:

  • https://github.com/isovector/type-errors/issues/9

Can we default to write-ghc-environment-files: always or would that break other packages? In the latter case, could we allow users to activate write-ghc-environment-files: always in the test settings?

See also:

  • #991
  • #981

andreasabel avatar Apr 09 '23 07:04 andreasabel

Just noting for myself, ~this allows the DocTests to work~ unreliably:

cabal build --write-ghc-environment-files=always
cabal test DocTests --write-ghc-environment=always

peterbecich avatar Mar 09 '24 05:03 peterbecich

@andreasabel , I can't make this work reliably. Can you give me the command to make the DocTests succeed? Thanks

peterbecich avatar Mar 09 '24 05:03 peterbecich

Do you mean for hackage-server? (Because this issue is about user packages uploaded to hackage that have doctests.)

andreasabel avatar Mar 09 '24 06:03 andreasabel

Oh, I misunderstood. Yes, I meant for hackage-server.

Are you able to run the hackage-server DocTests reliably?

peterbecich avatar Mar 09 '24 06:03 peterbecich

Well, yes, CI runs them every time. I just tried them locally.

  • cabal.project says: write-ghc-environment-files: always, so we are good there.
  • cabal build (necessary!)
  • cabal test DocTests

Works.

andreasabel avatar Mar 09 '24 07:03 andreasabel

For me, locally, with GHC 9.6, either of these causes the error:

cabal build --write-ghc-environment-files=always all; cabal test DocTests --write-ghc-environment=always

cabal build all; cabal test DocTests

However, with GHC 9.8, either succeeds.

The Nix Flake has GHC 9.6.

Thanks @andreasabel , that resolves it for now

peterbecich avatar Mar 10 '24 01:03 peterbecich