def testWithTempFile4(self): with auxiliary.cleanedUpTempDir(self.getDir(), "D1") as d1: with auxiliary.cleanedUpTempDir(d1, "D2") as d2: with auxiliary.cleanedUpTempDir(d2, "D3") as d3: with auxiliary.cleanedUpTempDir(d3, "D4") as d4: self.assertTrue(os.path.exists(d4)) self.assertTrue(os.path.exists(d3)) self.assertTrue(os.path.exists(d2)) self.assertTrue(os.path.exists(d1))
def testWithTempFile1(self): d = None with auxiliary.cleanedUpTempDir(self.getDir(), "D1") as tmp: self.assertTrue(os.path.exists(tmp)) d = tmp self.assertFalse(os.path.exists(d))
def testWithTempFile3(self): try: d = None with auxiliary.cleanedUpTempDir(self.getDir(), "D1", False) as tmp: d = tmp raise FooException self.assertTrue(os.path.exists(d)) except FooException: pass