[lang-ref] ( push_directory ) ( python )

def test_push_directory():
    # contextlib.chdir

    import contextlib

    org_dir = os.getcwd()
    new_dir = '/private/tmp'

    with contextlib.chdir(new_dir):
        assert os.getcwd() == new_dir

    # current directory is restored after block
    assert os.getcwd() == org_dir