def test_chdir(): current = os.getcwd() outer = os.path.abspath(utils.normalize(current, '..')) with utils.chdir('..'): eq_(os.getcwd(), outer) eq_(os.getcwd(), current) try: with(utils.chdir('you_shall_not_pass')): assert_true(False) # Shouldn't enter here except OSError: eq_(os.getcwd(), current)
def test_chdir(): current = os.getcwd() outer = os.path.abspath(utils.normalize(current, '..')) with utils.chdir('..'): eq_(os.getcwd(), outer) eq_(os.getcwd(), current)