Skip to content

Commit

Permalink
- make python tests runnable from build directory again
Browse files Browse the repository at this point in the history
- don't change testfiles in test runs
  • Loading branch information
jef-n committed Sep 8, 2012
1 parent e8a938a commit 82c4b4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
8 changes: 6 additions & 2 deletions tests/src/providers/testqgswcsprovider.cpp
Expand Up @@ -113,15 +113,19 @@ void TestQgsWcsProvider::read( )
{
foreach ( QString identifier, identifiers )
{
QString filePath = mTestDataDir + "/" + identifier + ".tif";
foreach ( QString ext, QStringList() << ".tif" << ".tif.aux.xml" )
{
QFile::remove( QDir::tempPath() + "/" + identifier + ext );
QVERIFY( QFile::copy( mTestDataDir + "/" + identifier + ext, QDir::tempPath() + "/" + identifier + ext ) );
}

QgsDataSourceURI uri;
uri.setParam( "url", mUrl );
uri.setParam( "identifier", identifier );
uri.setParam( "crs", "epsg:4326" );
uri.setParam( "version", version );

if ( !read( identifier, uri.encodedUri(), filePath, mReport ) )
if ( !read( identifier, uri.encodedUri(), QDir::tempPath() + "/" + identifier + ".tif", mReport ) )
{
ok = false;
}
Expand Down
19 changes: 2 additions & 17 deletions tests/src/python/utilities.py
Expand Up @@ -67,24 +67,9 @@ def getQgisTestApp():

if QGISAPP is None:
myGuiFlag = True # All test will run qgis in gui mode

# Note: QGIS_PREFIX_PATH is evaluated in QgsApplication - no need to mess with it here.
QGISAPP = QgsApplication(sys.argv, myGuiFlag)
# Note: QGIS_PREFIX_PATH is set by cmake to the output dir
if 'QGIS_PREFIX_PATH' in os.environ:
myPath = os.environ['QGIS_PREFIX_PATH']
myUseDefaultPathFlag = True
QGISAPP.setPrefixPath(myPath, myUseDefaultPathFlag)

if sys.platform.startswith('darwin'):
# override resource paths, otherwise looks for Resources in app
if 'QGIS_MAC_PKGDATA_DIR' in os.environ:
myPkgPath = os.environ['QGIS_MAC_PKGDATA_DIR']
QGISAPP.setPkgDataPath(myPkgPath)
if 'QGIS_MAC_SVG_DIR' in os.environ:
mySVGPath = os.environ['QGIS_MAC_SVG_DIR']
mySVGPaths = QGISAPP.svgPaths()
# doesn't get rid of incorrect path, just adds correct one
mySVGPaths.prepend(mySVGPath)
QGISAPP.setDefaultSvgPaths(mySVGPaths)

QGISAPP.initQgis()
s = QGISAPP.showSettings()
Expand Down

0 comments on commit 82c4b4a

Please sign in to comment.