'return context manager which changes to current dir during the
managed "with" context. On __enter__ it returns the old dir.'

@contextmanager
def as_cwd(self):

    old = self.chdir()
    try:
        (yield old)
    finally:
        old.chdir()
