jberryman
jberryman

Reputation: 16645

Importing modules from a dependency package's Test-Suite

I'd like to write some tests for my package which depends on a package foo, and I'd like to import some code written for foo's test-suite, but which isn't exported or exposed in foo.cabal.

In other words my dependency foo.cabal has this section

Test-Suite tests
  Type:               exitcode-stdio-1.0
  Build-Depends:      base, text, parsec >= 3, etc
  Main-Is:            Test/TestRunner.hs
  GHC-Options:        -fhpc -W -Wall -fno-warn-name-shadowing
  CPP-Options:        -DTESTING

And I'd like to import some of the modules that Test/TestRunner.hs imports. I also want to do this with cabal-dev.

Is there a way to do this without modifying foo? If not what would be a good way to patch foo to support that?

Maybe a more general version of my question is: can I tell cabal to give me access to un-exported code in another package?

Upvotes: 4

Views: 151

Answers (1)

jberryman
jberryman

Reputation: 16645

As Daniel Fischer suggests, this is probably a stupid thing to ask of cabal. Instead I probably want to fork the lib and export what I need. And maybe git submodules would help here.

Upvotes: 2

Related Questions