Exemplo n.º 1
0
    def test_load_shapefile(self):
        """Test loading shape file to QGIS Main Window.

        .. versionadded:: 3.2
        """
        zip_file_path = standard_data_path("control", "files", "test-importdlg-extractzip.zip")
        output_path = tempfile.mkdtemp()

        extract_zip(zip_file_path, output_path)

        shutil.rmtree(output_path)
Exemplo n.º 2
0
    def test_load_shapefile(self):
        """Test loading shape file to QGIS Main Window.

        .. versionadded:: 3.2
        """
        zip_file_path = standard_data_path('control', 'files',
                                           'test-importdlg-extractzip.zip')
        output_path = tempfile.mkdtemp()

        extract_zip(zip_file_path, output_path)

        shutil.rmtree(output_path)
Exemplo n.º 3
0
    def test_extract_zip(self):
        """Test extract_zip method.
        This function will only take care of one file for each extensions.
        If many files has the same extension, only the last one will be copied.

        .. versionadded:: 3.2
        """
        base_path = tempfile.mkdtemp()
        base_file_path = os.path.join(base_path, "test")
        zip_file_path = standard_data_path("control", "files", "test-importdlg-extractzip.zip")
        extract_zip(zip_file_path, base_file_path)

        message = "file {0} not exist"

        path = "%s.shp" % base_file_path
        assert os.path.exists(path), message.format(path)

        # remove temporary folder and all of its content
        shutil.rmtree(base_path)
Exemplo n.º 4
0
    def test_extract_zip(self):
        """Test extract_zip method.
        This function will only take care of one file for each extensions.
        If many files has the same extension, only the last one will be copied.

        .. versionadded:: 3.2
        """
        base_path = tempfile.mkdtemp()
        base_file_path = os.path.join(base_path, 'test')
        zip_file_path = standard_data_path('control', 'files',
                                           'test-importdlg-extractzip.zip')
        extract_zip(zip_file_path, base_file_path)

        message = "file {0} not exist"

        path = '%s.shp' % base_file_path
        assert os.path.exists(path), message.format(path)

        # remove temporary folder and all of its content
        shutil.rmtree(base_path)