Context manager to run in temporary directory
This is used to run certain operations, e.g. tleap, in a temporary directory. It is also used during the unit tests.