Test ex_unit before doctests
Implement extended doctest sessions. Closes #1020