-
Notifications
You must be signed in to change notification settings - Fork 717
Closed
Description
I have a simple cabal file:
name: doctest-depends
version: 0.1
build-type: Simple
cabal-version: >= 1.10
library
default-language: Haskell2010
exposed-modules: P
hs-source-dirs: src
build-depends: base, base-orphans
test-suite doctest
main-is: doctest.hs
type: exitcode-stdio-1.0
default-language: Haskell2010
build-depends: base, doctest, base-orphans
build-tool-depends: doctest-discover:doctest-discover
where the module P.hs
defines a doctest
module P where
import Base.Orphans ()
-- >>> square 5
-- 25
-- >>> square 4
-- 16
square ::Int -> Int
square x = x * x
and where doctest.hs
consists of:
{-# OPTIONS_GHC -F -pgmF doctest-discover #-}
When running cabal configure --enable-tests && cabal test
(using cabal-install v3 from git about a week ago) I get:
Test suite doctest: RUNNING...
cabal-testsuite/PackageTests/Doctest/Depends/src/P.hs:6:1: error:
Could not find module ‘Base.Orphans’
Use -v to see a list of the files searched for.
|
2 | import Base.Orphans ()
| ^^^^^^^^^^^^^^^^^^^^^^
The above project builds and passes the tests when run with stack
.
This is not a problem with doctest-discover
because if I remove the base-orphans
dependency and remove the Base.Orphans
import, the test builds and passes as expected.
It therefore seems that the doctest-discover
pre-processor is being executed without access to the package DB.
I would like to get some advice on how to fix this. I am currently looking at Distribution.Simple.Test.ExeV10.runTest
and looking to pass the package DB location to the test program there.