コード例 #1
0
 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))
コード例 #2
0
 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))
コード例 #3
0
    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))
コード例 #4
0
    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))
コード例 #5
0
    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
コード例 #6
0
    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