示例#1
0
 def test_mkdirs(self):
     "Make all the directories"
     second = tempfile.mkdtemp()
     nix.rmdir(second)
     self.assertFalse(os.path.exists(self.nodir))
     self.assertFalse(os.path.exists(second))
     try:
         nix.mkdir(self.nodir, second)
         self.assertTrue(os.path.exists(self.nodir))
         self.assertTrue(os.path.exists(second))
     finally:
         try:
             nix.rmdir(second)
         except OSError:
             pass
示例#2
0
 def test_mkdirs(self):
     "Make all the directories"
     second = tempfile.mkdtemp()
     nix.rmdir(second)
     self.assertFalse(os.path.exists(self.nodir))
     self.assertFalse(os.path.exists(second))
     try:
         nix.mkdir(self.nodir, second)
         self.assertTrue(os.path.exists(self.nodir))
         self.assertTrue(os.path.exists(second))
     finally:
         try:
             nix.rmdir(second)
         except OSError:
             pass
示例#3
0
 def test_mkdir_parents_false(self):
     "Should raise"
     self.assertFalse(os.path.exists(self.nodir))
     p = Path(self.nodir) + 'child/leaves'
     with self.assertRaises(exceptions.BadParentingError):
         nix.mkdir(p, parents=False)
示例#4
0
 def test_mkdir_parents(self):
     "make all parent dirs"
     self.assertFalse(os.path.exists(self.nodir))
     p = Path(self.nodir) + 'child/leaves'
     nix.mkdir(p, parents=True)
     self.assertTrue(os.path.exists(self.nodir))
示例#5
0
 def test_mkdir_path(self):
     "Should make a directory from a Path()"
     self.assertFalse(os.path.exists(self.nodir))
     nix.mkdir(Path(self.nodir))
     self.assertTrue(os.path.exists(self.nodir))
示例#6
0
 def test_mkdir_simple(self):
     "Should make a directory"
     self.assertFalse(os.path.exists(self.nodir))
     nix.mkdir(self.nodir)
     self.assertTrue(os.path.exists(self.nodir))
示例#7
0
 def mkdir(self, resource, parents=False):
     return nix.mkdir(resource, parents=parents)
示例#8
0
 def test_mkdir_parents_false(self):
     "Should raise"
     self.assertFalse(os.path.exists(self.nodir))
     p = Path(self.nodir) + 'child/leaves'
     with self.assertRaises(exceptions.BadParentingError):
         nix.mkdir(p, parents=False)
示例#9
0
 def test_mkdir_parents(self):
     "make all parent dirs"
     self.assertFalse(os.path.exists(self.nodir))
     p = Path(self.nodir) + 'child/leaves'
     nix.mkdir(p, parents=True)
     self.assertTrue(os.path.exists(self.nodir))
示例#10
0
 def test_mkdir_path(self):
     "Should make a directory from a Path()"
     self.assertFalse(os.path.exists(self.nodir))
     nix.mkdir(Path(self.nodir))
     self.assertTrue(os.path.exists(self.nodir))
示例#11
0
 def test_mkdir_simple(self):
     "Should make a directory"
     self.assertFalse(os.path.exists(self.nodir))
     nix.mkdir(self.nodir)
     self.assertTrue(os.path.exists(self.nodir))