WIP: eliminate more direct imports (HAS TEST FAILURES)

The bug might actually be in runtests.py, analysis is pending.