British-Oceanographic-Data-Centre / COAsT

A Coastal Ocean Assessment Tool built as an extendable python framework for nemo models
https://british-oceanographic-data-centre.github.io/COAsT/
MIT License
23 stars 11 forks source link

Change matplotlib backend for unit tests #645

Closed roje-bodc closed 8 months ago

roje-bodc commented 8 months ago

This fix has been created in order to avoid a threading issue when running the unit tests. It is caused by using the matplotlib gui backend outside of the main thread (I believe due to the use of subtests).

The fix is to use a non-interactive backend when running the unit tests.

An example of the error is:

image

The fix is also mentioned here: https://stackoverflow.com/questions/52839758/matplotlib-and-runtimeerror-main-thread-is-not-in-main-loop

roje-bodc commented 8 months ago

@jpolton I have created this pull request as a fix for the matplotlib threading error within the unit tests.

jpolton commented 8 months ago

Fantastic. I thought the solution would be far more troublesome. Well done @roje-bodc