Skip to content

Commit cfee2c3

Browse files
strknyalldawson
authored andcommittedMar 6, 2023
Add QGSTEST_NEED_PGTEST_DB macro in qgstest.h
Can be used by tests to declare their need for a qgis test db and allows users to skip them by defining a QGIS_PGTEST_DB_SKIP environment variable
1 parent 98841bd commit cfee2c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎src/test/qgstest.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@
104104
QCOMPARE( result.replace( QStringLiteral("ts=\" \" cs=\",\""), QStringLiteral("cs=\",\" ts=\" \"") ), expected ); \
105105
}(void)(0)
106106

107+
// Start your PostgreSQL-backend connection requiring test with this macro
108+
#define QGSTEST_NEED_PGTEST_DB() \
109+
if ( getenv( "QGIS_PGTEST_DB_SKIP" ) ) \
110+
QSKIP( "Test disabled due to QGIS_PGTEST_DB_SKIP env variable being set" );
111+
107112
/**
108113
* Base class for tests.
109114
*

0 commit comments

Comments
 (0)
Please sign in to comment.