コード例 #1
0
ファイル: test_io.py プロジェクト: pombreda/osc2
 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))
コード例 #2
0
ファイル: test_io.py プロジェクト: pombreda/osc2
 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()
コード例 #3
0
 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))
コード例 #4
0
 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()
コード例 #5
0
ファイル: test_io.py プロジェクト: pombreda/osc2
 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)
コード例 #6
0
 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)