Beispiel #1
0
 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
         ),
     )
Beispiel #2
0
    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)))
Beispiel #3
0
    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))
            )
Beispiel #4
0
 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"),
     )
Beispiel #5
0
 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"))
Beispiel #6
0
 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))