[testing] testing the error messages for plotting

This commit is contained in:
mzwiessele 2015-11-30 10:49:49 +00:00
parent 065ab725ff
commit 3c618c1525
2 changed files with 16 additions and 9 deletions

View file

@ -28,6 +28,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#===============================================================================
import matplotlib
from unittest.case import TestCase
matplotlib.use('agg')
import numpy as np
@ -35,13 +36,21 @@ import GPy, os
from nose import SkipTest
from ..util.config import config
from ..plotting import change_plotting_library
from ..plotting import change_plotting_library, plotting_library
class ConfigTest(TestCase):
def tearDown(self):
change_plotting_library('matplotlib')
def test_change_plotting(self):
self.assertRaises(ValueError, change_plotting_library, 'not+in9names')
change_plotting_library('none')
self.assertRaises(RuntimeError, plotting_library)
change_plotting_library('matplotlib')
if config.get('plotting', 'library') != 'matplotlib':
raise SkipTest("Matplotlib not installed, not testing plots")
try:
from matplotlib import cbook, pyplot as plt
from matplotlib.testing.compare import compare_images