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
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)
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))
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))
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))
def mkdir(self, resource, parents=False): return nix.mkdir(resource, parents=parents)