Workaround for buggy mac osx cleanup

This commit is contained in:
Matthias Kuhn 2016-04-14 19:33:29 +02:00
parent aa0b9fa895
commit 816c322df5
3 changed files with 16 additions and 10 deletions

View File

@ -223,7 +223,7 @@ unittest.TestCase = TestCase
unittest.expectedFailure = expectedFailure unittest.expectedFailure = expectedFailure
def start_app(): def start_app(cleanup=True):
""" """
Will start a QgsApplication and call all initialization code like Will start a QgsApplication and call all initialization code like
registering the providers and other infrastructure. It will not load registering the providers and other infrastructure. It will not load
@ -233,6 +233,11 @@ def start_app():
The initialization will only happen once, so it is safe to call this method repeatedly. The initialization will only happen once, so it is safe to call this method repeatedly.
Parameters
----------
cleanup: Do cleanup on exit. Defaults to true.
Returns Returns
------- -------
QgsApplication QgsApplication
@ -258,9 +263,9 @@ def start_app():
QGISAPP = QgsApplication(argvb, myGuiFlag) QGISAPP = QgsApplication(argvb, myGuiFlag)
QGISAPP.initQgis() QGISAPP.initQgis()
s = QGISAPP.showSettings() print(QGISAPP.showSettings())
print(s)
if cleanup:
import atexit import atexit
@atexit.register @atexit.register

View File

@ -15,6 +15,7 @@ __revision__ = '$Format:%H$'
import qgis # NOQA import qgis # NOQA
import os import os
import sys
import shutil import shutil
import tempfile import tempfile
@ -31,8 +32,8 @@ except ImportError:
print("You should install pyspatialite to run the tests") print("You should install pyspatialite to run the tests")
raise ImportError raise ImportError
# Convenience instances in case you may need them # Pass no_exit=True: for some reason this crashes on exit on Travis MacOSX
start_app() start_app(sys.platform != 'darwin')
TEST_DATA_DIR = unitTestDataPath() TEST_DATA_DIR = unitTestDataPath()

View File

@ -55,7 +55,7 @@ from utilities import (
) )
start_app() start_app(sys.platform != 'darwin') # No cleanup on mac os x, it crashes the pallabellingcanvas test on exit
FONTSLOADED = loadTestFonts() FONTSLOADED = loadTestFonts()
PALREPORT = 'PAL_REPORT' in os.environ PALREPORT = 'PAL_REPORT' in os.environ