Closed andrewcottam closed 4 years ago
See example 12 on this page which has some suggestions.
The following tests cause deadlocks: exportProject importProject exportPlanningUnitGrid - timeout (GET) importFeatures exportFeature - timeout (GET) createFeaturesFromWFS createFeatureFromLinestring - timeout (GET) - uses ogr2ogr in exportToShapefile importGBIFData
This was because of the unittest module not supporting asynchronous functions. See Ben Darnells article here.
The reason why the single test worked and the separate tests didnt is because of ogr2ogr defunct (zombie) processes that were created because the database connection was closed while ogr2ogr was running. Because the unittest module does not support coroutines, the exportProject function was called and then the tearDown method of unittest was called which closed the database connection immediately instead of waiting for the exportProject to finish. Now tearDown uses a helper which waits for the function to finish.
Although it creates deadlocks in the unittest.sh it doesn't in the marxan app.
Also, if you run the following sequence as a single test then it runs fine:
But, running it as separate tests creates a deadlock: