mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
Do not hard-code database connection parameters
Rely on libpq defaults instead (overridable via environment)
This commit is contained in:
parent
942c5e5f73
commit
ab580fbd0e
@ -42,17 +42,19 @@ Make sure that you have enabled building of postgres test in CMake.
|
||||
To test the postgres provider you will need to have a database available to
|
||||
which the postgres provider can connect. The server will need to have postgis
|
||||
support enabled.
|
||||
By default the test uses the following connection options:
|
||||
dbname='qgis_test'
|
||||
host=localhost
|
||||
port=5432
|
||||
user='postgres'
|
||||
password='postgres'
|
||||
|
||||
By default the test uses the following connection string:
|
||||
|
||||
dbname=qgis_test
|
||||
|
||||
If this does not match your setup you can set the environment variable
|
||||
QGIS_PGTEST_DB to the desired connection string.
|
||||
`QGIS_PGTEST_DB` to the desired connection string, or you can rely
|
||||
on standard libpq environment variables to tweak host, port user and
|
||||
password (PGHOST, PGPORT, PGUSER, PGPASSWORD).
|
||||
|
||||
Please note that the database needs to be initialized using the sql-script
|
||||
tests/testdata/provider/testdata.sql
|
||||
It takes care of activating postgis for the test database and
|
||||
creates some tables containing test data.
|
||||
|
||||
tests/testdata/provider/testdata_pg*.sql
|
||||
|
||||
They take care of activating postgis for the test database and
|
||||
create some tables containing test data.
|
||||
|
@ -33,7 +33,7 @@ class TestPyQgsPostgresProvider(unittest.TestCase, ProviderTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Run before all tests"""
|
||||
cls.dbconn = u'dbname=\'qgis_test\' host=localhost port=5432 user=\'postgres\' password=\'postgres\''
|
||||
cls.dbconn = u'dbname=\'qgis_test\''
|
||||
if 'QGIS_PGTEST_DB' in os.environ:
|
||||
cls.dbconn = os.environ['QGIS_PGTEST_DB']
|
||||
# Create test layers
|
||||
|
Loading…
x
Reference in New Issue
Block a user