def test_copy_chmod(self):
     try:
         do = DirectoryObject("test", temporary=True)
         do_copy = do.copy("test_copy")
         do_copy.chmod(0o644)
         if oct(os.stat(do_copy.path).st_mode & 0o777) != oct(0o644):
             raise Exception("Wrong mode of copied directory")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
 def test_copy(self):
     try:
         do = DirectoryObject("test", temporary=True)
         do_copy = do.copy("test_copy")
         if not isinstance(do_copy, DirectoryObject):
             raise Exception("DirectoryObject hasn't been returned as copy")
         if not os.path.exists("test_copy"):
             raise Exception("Failed to copy")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)