def test_mkdir_command_generator(self): hdfs_client.mkdir( path="/tmp/test", executor=lambda command, *args: self._assert_command_generation("hadoop fs -mkdir /tmp/test")( command, *args ), )
def create_directory(self, recursive=True): """ Creates a new directory unless it already exists :param recursive: if True, will create all parent folders """ if not self.exists(): if recursive and not self.base_dir().exists(): self.base_dir().create_directory(recursive) fs.mkdir(self.path).if_failed_raise( FileSystemException( "Cannot create directory '{path}'".format(path=self.path)))
def create_directory(self, recursive=True): """ Creates a new directory unless it already exists :param recursive: if True, will create all parent folders """ if not self.exists(): if recursive and not self.base_dir().exists(): self.base_dir().create_directory(recursive) fs.mkdir(self.path).if_failed_raise( FileSystemException("Cannot create directory '{path}'".format(path=self.path)) )
def test_mkdir_command_generator_negative(self): hdfs_client.mkdir( "/tmp/test", executor=lambda command, *args: self.assertEqual(build_command(command, *args), "mkdir /tmp/test"), )
def test_mkdir_command_generator_negative(self): hdfs_client.mkdir( "/tmp/test", executor=lambda command, *args: self.assertEqual( build_command(command, *args), "mkdir /tmp/test"))
def test_mkdir_command_generator(self): hdfs_client.mkdir( path="/tmp/test", executor=lambda command, *args: self._assert_command_generation( "hadoop fs -mkdir /tmp/test")(command, *args))