def test_pushd(self): cwd = osp.realpath(os.getcwd()) with tempdir() as path, pushd(path) as ppath: path = osp.realpath(path) ppath = osp.realpath(ppath) cwd_in_context = osp.realpath(os.getcwd()) self.assertNotEqual(cwd, cwd_in_context) self.assertEqual(path, ppath) self.assertEqual(path, cwd_in_context) self.assertEqual(cwd, osp.realpath(os.getcwd())) self.assertFalse(osp.isdir(path))
def test_pushd_keep_dir(self): with tempdir(remove=False) as path: self.assertTrue(osp.isdir(path)) self.assertTrue(osp.isdir(path))