Exemplo n.º 1
0
    def setUpClass(cls):
        """Run before all tests"""

        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain(cls.__name__)
        QCoreApplication.setApplicationName(cls.__name__)
        start_app()
        cls.postgres_conn = "service='qgis_test'"
        if 'QGIS_PGTEST_DB' in os.environ:
            cls.postgres_conn = os.environ['QGIS_PGTEST_DB']
        cls.uri = cls.postgres_conn + ' sslmode=disable'
    def setUpClass(cls):
        """Run before all tests"""
        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain(cls.__name__)
        QCoreApplication.setApplicationName(cls.__name__)
        start_app()

        gpkg_original_path = '{}/qgis_server/test_project_wms_grouped_layers.gpkg'.format(TEST_DATA_DIR)
        cls.basetestpath = tempfile.mkdtemp()
        cls.gpkg_path = '{}/test_gpkg.gpkg'.format(cls.basetestpath)
        shutil.copy(gpkg_original_path, cls.gpkg_path)
        vl = QgsVectorLayer('{}|layername=cdb_lines'.format(cls.gpkg_path), 'test', 'ogr')
        assert vl.isValid()

        gpkg2_original_path = '{}/points_gpkg.gpkg'.format(TEST_DATA_DIR)
        cls.gpkg_path2 = '{}/test_gpkg2.gpkg'.format(cls.basetestpath)
        shutil.copy(gpkg2_original_path, cls.gpkg_path2)
        vl = QgsVectorLayer('{}'.format(cls.gpkg_path2), 'test', 'ogr')
        assert vl.isValid()
Exemplo n.º 3
0
__copyright__ = 'Copyright 2020, The QGIS Project'

import qgis  # NOQA

import os

from qgis.core import (QgsProviderRegistry, QgsFields, QgsField, QgsWkbTypes,
                       QgsCoordinateReferenceSystem)
from qgis.gui import QgsDatabaseTableComboBox
from qgis.PyQt.QtCore import QCoreApplication, QVariant
from qgis.PyQt.QtTest import QSignalSpy

from qgis.testing import unittest
from utilities import unitTestDataPath, start_app

start_app()

TEST_DATA_DIR = unitTestDataPath()


class TestQgsDatabaseTableComboBox(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        """Run before all tests"""

        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain(cls.__name__)
        QCoreApplication.setApplicationName(cls.__name__)
        start_app()
        cls.postgres_conn = "service='qgis_test'"
        if 'QGIS_PGTEST_DB' in os.environ: