try-catch in test.py causes uncomprehensible pdb stack running with pytest.
test.py uses try-catch-finally to capture temporary files.
However if we try to debug a test failure inside such block, pdb cannot fall into the local scope of the exception, but would rather only jump to the scope of the finally clause.
I wonder if using a context manager may be work around this. Or perhaps moving clean-up outside of the finally clause is still acceptable, since test failure is already unexpected, and when failure occurs one is likely interested to inspect the temporary file any ways.
We should probably just move to pytest but that is a lot of work.
My impression was pytest also has the finally clause exception issue.
Getting rid of the try-catch is less work and results easier test cases on the other hand.