def test_cd_bad_oldcwd(): # Test attempting to go back to a directory that no longer exists. name = tempfile.mkdtemp() with cd(name): assert_equal(os.getcwd(), name) with cd('/'): assert_equal(os.getcwd(), '/') os.rmdir(name) assert_equal(os.getcwd(), '/')
def test_cd_bad_oldcwd(): # Test attempting to go back to a directory that no longer exists. name = tempfile.mkdtemp() with cd(name): assert os.getcwd() == os.path.realpath(name) with cd(root): assert os.getcwd() == root os.rmdir(name) assert os.getcwd() == root
def test_cd(): with cd('/'): assert_equal(os.getcwd(), '/')
def test_cd(): with cd(root): assert os.getcwd() == root