@contextlib.contextmanager
def cd(newpath):
    oldpath = os.getcwd()
    os.chdir(newpath)
    try:
        yield
    finally:
        try:
            os.chdir(oldpath)
        except OSError:
            # If oldpath no longer exists, stay where we are.
            pass

# Check Sphinx version
Tests that batches returned by an iterator with topological
dataset/ETHPy150Open networkx/networkx/doc/source/conf.py/cd--crossover with--dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/datasets/tests/test_cifar100.py/TestCIFAR100.test_iterator