-
-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
polysemy-plugin: Make plugin available to doctest #71164
Comments
Notes: Results of adding ":show" flags to doctest (test/TypeErrors.hs): :show packages
:show linker
:show imports
I would expect that these would need to at least have Suggests to me that maybe doctests exe isn't loading the package-db. |
Hmm, adding to the doctest args:
I can then see polysemy with So I need to source a package-db with |
Ok, progress! I think I'm at least partially correct with the above. If I source the package-db created as part of the build, I can get the doctest to pass. I fed "-package-db $src/dist-newstyle/packagedb/ghc-8.6.5" to doctest via the args:
And the tests pass! Note "-package-db ./dist-newstyle/packagedb/ghc-8.6.5" or "-package-db ./dist/package.conf.inplace" will also suffice (depending on cabal version). So, now my question/issue changes to "What's the best way for me to source the built package-db in the doctests of this package?" One way would be to add something to the "preCheck" hook that modifies the source code, but I imagine that would be frowned upon. |
Additionally, does this issue need to be pushed upstream? If so, is there a more general way we can do it? The package.conf is going to be in different locations for different users/different versions of cabal/ghc/etc. |
@sevanspowell I think you diagnosed this problem correctly. The doctests are being run in an environment that doesn't necessarily know about all of the other targets from the This is actually a pretty big problem when running This means that if you use plain doctests, you often have problems when building with different build tools. In nixpkgs, you can find a lot of Haskell packages where the tests are disabled purely because the doctests aren't working well. The only "correct" solution is to use a wrapper around http://hackage.haskell.org/package/cabal-doctest Another possible solution is just to add the packages needed by This isn't really correct though, since the doctest test target in the cabal file normally doesn't actually need a Of course, the easiest solution is just to disable the tests for polysemy-plugin when building in nixpkgs. Also, I should say that I don't have any experience using GHC plugins, so it is possible that GHC plugins require some other work-arounds when using doctests. |
I'd say that the best way is to change |
Thanks @cdepillabout :) |
There's a single doctest. So I might try submitting a PR to polysemy-plugin to use cabal doctest, see if that fixes the issue. |
- Haskell build tools run in slightly different environments (meaning different package databases are available). - The nixpkgs build for polysemy-plugin is failing due to a missing package database, which causes the doctest to fail (more information here: NixOS/nixpkgs#71164). - By using cabal-doctest we can expose the Haskell packages required to the doctests no matter the build tool we're using.
- polysemy-plugin was broken due to failing doctests: NixOS#71164. - I submitted a PR upstream to fix this: polysemy-research/polysemy#265. - I've applied the patch of the PR here and moved the default "polysemy" attribute to "polysemy_1_2_0_0" because polysemy-plugin requires "polysemy >= 1.2.0.0". - Move default "polysemy-zoo" attribute to "polysemy-zoo_0_6_0_1" because it is fixed by the polysemy-plugin changes and fixes issues with building "polysemy-RandomFu" and "knit-haskell". - Removed packages no longer broken from "configuration-hackage2nix.yaml". - Add cabal-doctest to setupDepends of polysemy-plugin.
* Use cabal-doctest - Haskell build tools run in slightly different environments (meaning different package databases are available). - The nixpkgs build for polysemy-plugin is failing due to a missing package database, which causes the doctest to fail (more information here: NixOS/nixpkgs#71164). - By using cabal-doctest we can expose the Haskell packages required to the doctests no matter the build tool we're using. * Use cabal-doctest in polysemy, build on GHC 8.8.1 - Use @googleson78 's changes to build polysemy on GHC 8.8.1, with slight modifications. The source distribution is now found in "dist-newstyle/sdist", so we've updated the command to point at that folder. Additionally, cabal v2-install doesn't support installing .tar.gz files in the same way v1-install did, so updated the command to use "cabal v1-install". - Modified polysemy to use "cabal-doctest" and so overcome issues with the doctest tests (see issue #258, PR #265).
Thanks all! Upstream issue fixed here: polysemy-research/polysemy#267 |
- polysemy-plugin was broken due to failing doctests: #71164. - I submitted a PR upstream to fix this: polysemy-research/polysemy#265. - I've applied the patch of the PR here and moved the default "polysemy" attribute to "polysemy_1_2_0_0" because polysemy-plugin requires "polysemy >= 1.2.0.0". - Move default "polysemy-zoo" attribute to "polysemy-zoo_0_6_0_1" because it is fixed by the polysemy-plugin changes and fixes issues with building "polysemy-RandomFu" and "knit-haskell". - Removed packages no longer broken from "configuration-hackage2nix.yaml". - Add cabal-doctest to setupDepends of polysemy-plugin.
Describe the bug
polysemy-plugin
is broken on thehaskell-updates
branch of nixpkgs. I was working on fixing this, but ran into a problem I don't know how to overcome.The package builds fine and the tests run, but one of the doctests do not pass:
AFAIK "polysemy-plugin" is a GHC plugin and this doctest tries to import the plugin and set it up before running the test, but it's not available to the doctest.
I noticed that when a test requires executables built by the package, we do something like this:
Is there an equivalent for exposing plugins built by the package to the test? I assumed that it would already be "in-scope" so to speak.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Builds and tests pass.
Metadata
Maintainer information:
@peti
The text was updated successfully, but these errors were encountered: