def test_tmpdir2(self): """simple temporary directory (remove with rmdir)""" tmpdir = TemporaryDirectory(dir=self._tmpdir) path = tmpdir.path self.assertIsNotNone(path) self.assertTrue(os.path.isdir(path)) tmpdir.rmdir() self.assertIsNone(tmpdir.path) self.assertFalse(os.path.isdir(path))
def test_tmpdir12(self): """test manual removal of the tmpdir""" tmpdir = TemporaryDirectory(dir=self._tmpdir) path = tmpdir.path self.assertTrue(os.path.exists(path)) os.rmdir(path) self.assertFalse(os.path.exists(path)) # as long as the directory is gone, we are fine tmpdir.rmdir()
def test_tmpdir2(self): """simple temporary directory (remove with rmdir)""" tmpdir = TemporaryDirectory(dir=self._tmpdir) path = tmpdir.path self.assertIsNotNone(path) self.assertTrue(os.path.isdir(path)) tmpdir.rmdir() self.assertIsNone(tmpdir.path) self.assertFalse(os.path.isdir(path))
def test_tmpdir12(self): """test manual removal of the tmpdir""" tmpdir = TemporaryDirectory(dir=self._tmpdir) path = tmpdir.path self.assertTrue(os.path.exists(path)) os.rmdir(path) self.assertFalse(os.path.exists(path)) # as long as the directory is gone, we are fine tmpdir.rmdir()
def test_tmpdir3(self): """multiple remove""" tmpdir = TemporaryDirectory(dir=self._tmpdir) path = tmpdir.path self.assertIsNotNone(path) self.assertTrue(os.path.isdir(path)) tmpdir.rmtree() self.assertFalse(os.path.isdir(path)) # a call to path does not recreate the tmpdir self.assertIsNone(tmpdir.path) self.assertFalse(os.path.isdir(path)) # recreate directory os.mkdir(path) self.assertTrue(os.path.isdir(path)) # subsequent rmdir/rmtree calls have no affect anymore tmpdir.rmdir() tmpdir.rmtree() self.assertTrue(os.path.isdir(path)) os.rmdir(path)
def test_tmpdir3(self): """multiple remove""" tmpdir = TemporaryDirectory(dir=self._tmpdir) path = tmpdir.path self.assertIsNotNone(path) self.assertTrue(os.path.isdir(path)) tmpdir.rmtree() self.assertFalse(os.path.isdir(path)) # a call to path does not recreate the tmpdir self.assertIsNone(tmpdir.path) self.assertFalse(os.path.isdir(path)) # recreate directory os.mkdir(path) self.assertTrue(os.path.isdir(path)) # subsequent rmdir/rmtree calls have no affect anymore tmpdir.rmdir() tmpdir.rmtree() self.assertTrue(os.path.isdir(path)) os.rmdir(path)