Skip to content
Permalink
Browse files

Workaround for buggy mac osx cleanup

  • Loading branch information
m-kuhn committed Apr 15, 2016
1 parent aa0b9fa commit 816c322df5757e37d2cbc2d9fd634e8376b713d7
@@ -223,7 +223,7 @@ def wrapper(*args, **kwargs):
unittest.expectedFailure = expectedFailure


def start_app():
def start_app(cleanup=True):
"""
Will start a QgsApplication and call all initialization code like
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.
Parameters
----------
cleanup: Do cleanup on exit. Defaults to true.
Returns
-------
QgsApplication
@@ -258,14 +263,14 @@ def start_app():
QGISAPP = QgsApplication(argvb, myGuiFlag)

QGISAPP.initQgis()
s = QGISAPP.showSettings()
print(s)
print(QGISAPP.showSettings())

import atexit
if cleanup:
import atexit

@atexit.register
def exitQgis():
QGISAPP.exitQgis()
@atexit.register
def exitQgis():
QGISAPP.exitQgis()

return QGISAPP

@@ -15,6 +15,7 @@
import qgis # NOQA

import os
import sys
import shutil
import tempfile

@@ -31,8 +32,8 @@
print("You should install pyspatialite to run the tests")
raise ImportError

# Convenience instances in case you may need them
start_app()
# Pass no_exit=True: for some reason this crashes on exit on Travis MacOSX
start_app(sys.platform != 'darwin')
TEST_DATA_DIR = unitTestDataPath()


@@ -55,7 +55,7 @@
)


start_app()
start_app(sys.platform != 'darwin') # No cleanup on mac os x, it crashes the pallabellingcanvas test on exit
FONTSLOADED = loadTestFonts()

PALREPORT = 'PAL_REPORT' in os.environ

0 comments on commit 816c322

Please sign in to comment.
You can’t perform that action at this time.