Fix clashes between debugger tests and coverage.py

coverage.py works by setting the trace function. But so does the
debugger, so we need to re-set it afterwards to get accurate coverage
results.
Merge pull request #4102 from takluyver/coverage-debugger-clash

Fix clashes between debugger tests and coverage.py