Пример #1
0
 def test3b_delete_tree_constraint(self):
     if self.home:
         err = None
         try:
             tu.delete_tree(self.home_junk)
         except tu.TestError as e:
             err = e.value
         self.assertFalse(err is None, 
             "deltree on %r raises TestError" % (self.home_junk))
     else:
         self.fail("Skip deltree constraint test, no '$HOME' var")
Пример #2
0
 def test3b_delete_tree_constraint(self):
     if self.home:
         err = None
         try:
             tu.delete_tree(self.home_junk)
         except tu.TestError as e:
             err = e.value
         self.assertFalse(
             err is None,
             "deltree on %r raises TestError" % (self.home_junk))
     else:
         self.fail("Skip deltree constraint test, no '$HOME' var")
Пример #3
0
 def test3b_delete_tree_constraint(self):
     if self.home:
         sep = os.path.sep
         tmp = tempfile.gettempdir() + sep
         if ((self.home + sep).startswith(tmp)):
             self.skipTest("skipping delete_tree_constraint test")
         err = None
         try:
             tu.delete_tree(self.home_junk)
         except tu.TestError as e:
             err = e.value
         self.assertFalse(
             err is None,
             "deltree on %r raises TestError" % (self.home_junk))
     else:
         self.fail("Skip deltree constraint test, no '$HOME' var")
Пример #4
0
    def test3a_subdir(self):
        for sub in self.asubs:
            self.assertFalse(os.path.isdir(sub), "init: no dir %r" % sub)
            b,d = os.path.dirname(sub), os.path.basename(sub)
            md = tu.make_subdir(d, b)
            self.assertTrue(os.path.isdir(sub), "made dir %r" % sub)
            self.assertEqual(md,sub, tu.msg(md,sub, 
                "make_subdir returns path"))

            s2 = os.path.join(sub,"sub2")
            tu.make_subdir("sub2", sub)
            self.assertTrue(os.path.isdir(s2), "made dir %r" % s2)
            f = os.path.join(s2,"test_file")

            open(f,"w").write("testing..")
            self.assertTrue(os.path.isfile(f), "file %r exists" % f)
            tu.delete_tree(sub)
            self.assertFalse(os.path.isdir(sub), 
                "delete_tree removes subdir %r" % sub )
Пример #5
0
    def test3a_subdir(self):
        for sub in self.asubs:
            self.assertFalse(os.path.isdir(sub), "init: no dir %r" % sub)
            b, d = os.path.dirname(sub), os.path.basename(sub)
            md = tu.make_subdir(d, b)
            self.assertTrue(os.path.isdir(sub), "made dir %r" % sub)
            self.assertEqual(md, sub,
                             tu.msg(md, sub, "make_subdir returns path"))

            s2 = os.path.join(sub, "sub2")
            tu.make_subdir("sub2", sub)
            self.assertTrue(os.path.isdir(s2), "made dir %r" % s2)
            f = os.path.join(s2, "test_file")

            open(f, "w").write("testing..")
            self.assertTrue(os.path.isfile(f), "file %r exists" % f)
            tu.delete_tree(sub)
            self.assertFalse(os.path.isdir(sub),
                             "delete_tree removes subdir %r" % sub)