Ok, I see two separate stories here:
1. Allow others to use Doctest with `cabal sandbox`
2. Make Doctests own test-suite work with `cabal sandbox`

I'm mostly concerned about (1), because this is what matters for users of Doctest, and I think we can achieve one without code duplication.

Regarding (2) I'm puzzled whether the extra duplication is worth the benefit that we get from it.  At least for me it's currently not important to be able to use `cabal sandbox` during Doctest development, because Doctest has very view dependencies that I can just install globally.  Is it an important use case for you?